Anish Kumar K. wrote:
I wrote a script to upload one file to one location. The HTML files
reads a particular file using <input type=file> and in the form
action I have called upload.pl file.

in the upload.pl file...
    $upload_dir = "/home/anish/upload";
    $filename = $q->param("filename");
    $email_address = $q->param("email_address");
    $filename =~ s/.*[\/\\](.*)/$1/;

    print $q->p("The File Name is:  $filename");

    $upload_filehandle = $q->upload("photo");

    open UPLOADFILE, ">$upload_dir/$filename";

     binmode UPLOADFILE;

     while (<$upload_filehandle>)
     {
      print UPLOADFILE;
     }
                       close UPLOADFILE;


The file handling is not working correctly..

That's a pretty useless description of your problem. Can you be more specific?

I am not sure what is wrong with this code...

- You are not using strictures (and probably not warnings either).

- You don't check for success when opening the file.

Besides that, I don't see anything obviously wrong.

What does the form look like?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to