Link to home
Start Free TrialLog in
Avatar of oucher
oucher

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of khacharn
khacharn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oucher
oucher

ASKER

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">
</form>


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

http://perlguy.com/perl/upload.txt


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.


/Probie