CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
More help neede on file uploading...



Sep 28, 2000, 6:32 PM

Post #1 of 2 (1014 views)
More help neede on file uploading... Can't Post

I'm using the small upload script from the guys (couple of posts back) and am having trouble... The script :

use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
$objetcgi = new CGI;
$nomimage = $objetcgi->param("nomimage");
$file = $objetcgi->param("image");
open (MYFILE, ">$nomimage") or die $!;
while (my $bytesread = read($file, my $buffer, 1024)) {
$bytes = $bytesread;
$kb += ($bytes / 1000);
print MYFILE $buffer;

the form object "nomimage" is a .jpg image name and "image" is, of course, the file on my computer. Yes, I am using a upload multipart form field. So, I read $kb and $bytes at the end of the cycle and they're blank! Anyone know what's this about? btw, I'm writing to cgi-bin. It does work since I do a filehandle print to that dir and create a small html file without a problem. Any help? Thanks a lot!

[This message has been edited by Merlin (edited 09-28-2000).]


Sep 28, 2000, 8:07 PM

Post #2 of 2 (1014 views)
Re: More help neede on file uploading... [In reply to] Can't Post

I had another question. After reading a bit on the subject, I found that the $file is the place where a filehandle is supposed to be. So, if $file is the name of my file on my computer, can it be a substitute to a filehanlde even if it hasn't been declared with the usual open (FILEHANDLE, "filename"); ? I tried doing the open(...) command and got, you guessed it, an error. I guess being on my computer is a bit far for the script to open? Thanks...


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives