
Merlin
journeyman
Oct 5, 2000, 11:37 AM
Post #1 of 3
(476 views)
|
|
Rather urgent help needed...
|
Can't Post
|
|
Sorry for asking again but time is not a luxury for me at this stage of the project... So, I've got this file upload routine that won't start. I get no error messages, just a 0 byte length file at the end (on the server). The filename on the server is right. The code (I "borrowed" from here and there so it's not all by me...) : use CGI; use IO::Handle; use IO::File; use CGI::Carp 'fatalsToBrowser'; $objetcgi = new CGI; $file = $objetcgi->param("image"); $nomimage = $objetcgi->param("nomimage"); $fh = new IO::Handle->fdopen(fileno($file), "r"); $newfh = new IO::File $nomimage, "w"; if ($^O =~ /Win32/) { binmode($newfh); binmode($fh); } while ($bytesread = sysread($fh, $buffer, 1024)) { $kb += ($bytesread / 1000); $n = syswrite($newfh, $buffer, $bytesread); } close ($newfh); close ($fh); So, $nomimage is the new filename and seems ok. The $file is the upload field from the form. I am using a multipart as form field. Running, the script, I've seen it doesn't even go through the while loop and just opens and closes both read and write filehandles. If someone could please help on this, I'd be eternally grateful (I often am to a lot of people these days!) Thanks in advance! p.s.: I tried another version of script (the one from Anthony et al. a couple of posts back) and got the exact same results as with the above mentionned script. [This message has been edited by Merlin (edited 10-05-2000).]
|