jijo-paulose / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
0 stars 0 forks source link

error uploading large files #185

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to upload any kind of file bigger than 20MBy aprox. 
2. Try to open the server side uploaded file

What is the expected output? What do you see instead?
I expect to see the entire file on the server side, but sometimes it has 0 
bytes and sometimes it has a smaller size than the original in my computer 
(curiously not bigger than 13MBy).

What version of the product are you using? On what operating system?
JsUpload-0.6.6 and cgi-pearl.

Please provide any additional information below.
I think the problem could be in the saveFile() function. I added echo messages 
printing variables to log it, like this:
(...)
while ($n = read($fd, $data, 65536)) {
   system('echo value of n: '.$n.' >> /tmp/p.log');
   print BIN $data;
}
(...)

If I try to upload a file smaller than 20MBy, it works OK and I can see in the 
log file the 'value of n', but if I try to upload a file bigger than 20MBy. 
(aproximately) it doesn't appear the 'value of n' in the log file.

Why? I don't now and I'm getting angry...xdd
I check if the filehandler ($fd) is 'defined' and in both cases are 'true'.

Original issue reported on code.google.com by sergi.na...@gmail.com on 12 Nov 2013 at 11:48

GoogleCodeExporter commented 8 years ago
I override this part of code within the saveFile() function:

open( BIN, ">$bin_file" ) || return;
   binmode(BIN);
   my ($data, $n);
      while ($n = read($fd, $data, 65536)) {
    print BIN $data;
      }    
   close(BIN);

to--> copy($data_file, $bin_file);

And now it's working!!!! :-)))

Original comment by sergi.na...@gmail.com on 12 Nov 2013 at 1:08

GoogleCodeExporter commented 8 years ago
The problem with your fix is that it does not work with a request with multiple 
files. 

$data_file contains all the POST payload including boundaries, so I think your 
files could be corrupted.

Could you try to replace read by sysread, and let me know if it works?

Original comment by manuel.carrasco.m on 31 Dec 2013 at 4:54

GoogleCodeExporter commented 8 years ago

Original comment by manuel.carrasco.m on 13 Jan 2015 at 10:44