cranberry13 has asked for the wisdom of the Perl Monks concerning the following question:
Then, in my "profile_step4.pl" script, I have the following:<form action="profile_step4.pl" enctype="multipart/form-data" > choose file <input type="file" name="photo1"> <input type="submit"> </FORM>
#!/usr/local/bin/perl use CGI; print "Content-type: text/html\n\n"; &GetAllCookies; my $userid = $Cookies{userid}; $upload_dir = "/usr/home/tiri/htdocs/upload/"; ## not the real path . +.. but the path is to my htdocs/upload directory (which already exist +s) $mydir .= $upload_dir .$userid ; `mkdir $mydir`; ## create the directory for this user print "created the dir $mydir"; $query = new CGI; $filename = $query->param("photo1"); $upload_filehandle = $query->upload("photo1"); $filename=~ s/.*[\/\\](.*)/$1/; open (UPLOADFILE, ">$mydir/$filename")|| die $! ; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;
Any suggestions on why this isn't working? When i run the program, i was able to determine that the program dies on the statement:
Why is it dying here? Do I need to set the 'upload' directory with any special permissions?$upload_filehandle = $query->upload("photo1");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems uploading file
by Grygonos (Chaplain) on Jun 30, 2004 at 14:06 UTC | |
|
Re: Problems uploading file
by ercparker (Hermit) on Jun 30, 2004 at 15:58 UTC | |
|
Re: Problems uploading file
by iburrell (Chaplain) on Jun 30, 2004 at 19:01 UTC |