Uploading files

Does anyone know how to

1) make a form be able to upload binary files (I know there's something you have to put in the form tag, but I can't remember what)

2) use Perl to get that data and write it to a file

For uploading pictures to a web page, etc.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

khacharnConnect With a Mentor Commented:
hi oucher
Well you can use Net::Ftp module to upload/Download files to and from a Server..
Tell me if you need more help
oucherAuthor Commented:
Okay, I'm sure that'll work.  But I know I've seen it done before without using any modules, I just can't remember how.  I would prefer to do it without using a module if I could.  Any ideas?
Here comes the answer:

<form method="POST" name="AddForm" action="/cgi/upload.pl" enctype="multipart/form-data">
 <input type="file" name="upload">
 <input type="submit" name="B1">

of course you have to suply your own perl script. Free ones can be downloaded from many pages. Here comes a good link:


When I once wrote an upload service I forgot to set the enctype field in the form tag... THAT IS VERY IMPORTANT.

ENCTYPE must be set to: multipart/form-data

(enctype="multipart/form-data") to make it work.


All Courses

From novice to tech pro — start learning today.