XUpload - Exceed upload size message

Message
Author
happy
Posts: 5
Joined: Sep 28, 2007 8:15 pm

Exceed upload size message

#1 Postby happy » Sep 28, 2007 8:21 pm

I noticed the system in upload.cgi it compares the upload size with what is set in the config file. For example,
if($ENV{'CONTENT_LENGTH'} > 1024*$c->{max_upload_size})

But what I noticed is that the response time is slow and also the larger the file is the more time it takes for the alert message to display, but the it logs the error right away.

I tried myself to modify the script without any luck to increase the response time with no luck. Is there anyone that can help me on this matter?

Thanks,
Lou

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Oct 01, 2007 6:20 am

Don't quite understand what "message to disaplay" you're talking about. There should be message in progress bar window after 1-5 seconds after start of upload. In your case it looks you're talking about message from upload.cgi after complete upload. Do you open Progress Bar window? What do you have there?

happy
Posts: 5
Joined: Sep 28, 2007 8:15 pm

#3 Postby happy » Oct 01, 2007 1:51 pm

PilgrimX182, I am talking about the alert message when the file size exceeds the max upload size.
For example, I have set up the max upload size to 100MB. If I try to upload anything bigger than 100MB. It will take a long time for the javascript alert message stating that you have exceeded the total upload size. Some times the total upload exceeded message does not even show up but I do get the SSL message stating that this page contains both secure and unsecure items because it is running on https protocol. After I click yes to display the unsecure items the script stops and I get a javascript access denied error. First I do not know what page it's trying to open up which has unsecure items and why I have access denied.
My main concern is that it takes a long time for the exceed total upload file size alert message to appear, but it logs the error right away.
This is the message I am talking about in upload.cgi file, the following code,
if($ENV{'CONTENT_LENGTH'} > 1024*$c->{max_upload_size})
{
&lmsg("ERROR: $c->{msg}->{upload_size_big}$c->{max_upload_size} Kb");
sleep 1;
&DelData($temp_dir);
&xmessage("ERROR: $c->{msg}->{upload_size_big}$c->{max_upload_size} Kb");
}
but the earlier code to log the upload size in upload.cgi
&logit("Starting upload. Size: $ENV{'CONTENT_LENGTH'}");
logs it right away.

I have set up a test page for you to see what I am talking about. The test page does not display properly because I had to take couple of things out. I have set up the max upload size to 2 MB. If you load anything less than 2 MB it works fine but anything bigger than 2 MB takes a while to display the alert message.
Here is the link, https://www.happysoftware.com/XUpload/uploadFile.php

Thanks,
Lou

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Oct 02, 2007 6:18 am

I guess your problem is that progress bar window is a bit slow down so file with error got deleted before progress bar activates.

Here goes possible solution: in upload.cgi find

Code: Select all

   &lmsg("ERROR: $c->{msg}->{upload_size_big}$c->{max_upload_size} Kb");
   sleep 1;
and replace "sleep 1;" with "sleep 5;"

this should help.

happy
Posts: 5
Joined: Sep 28, 2007 8:15 pm

#5 Postby happy » Oct 02, 2007 6:08 pm

Thanks for the quick and easy solution PilgrimX182.

Lou