How to upload a file from a user's desktop to a web server?

S

srini

Hi all,

I am writing a HTML/CGI perl script to attach a file from a HTML
submit form and to store that attachment in a tmeporary variable on
the web server that hosts the perl script.

snippet of code:

HTML part:
---------------
<tr><td colspan="2"> <FONT color=black>Attachment (if any):</FONT><BR>
<INPUT type="file" size=50 name="attachedfile" ALLOW="text/*">
</td></tr>
--------------


Perl code:
-----------------------------------------------
$attachedFile = $query -> param ("attachedfile");
# $attachedFile =~ s/\\/\\\\/g;
------------------------------------------------

Now I want to capture the file attachment from a user's desktop and
upload it into a temp variable on the web server. I tired to use
fielfield() and tmpFileName() functions, but in vain.

Can some boby kindly tell me how my perl code should be modified so
that I can store the $attachedFile in to $temp variable on the web
server?

Thanks in advance,
Srini
 
T

Tore Aursand

Can some boby kindly tell me how my perl code should be modified so that
I can store the $attachedFile in to $temp variable on the web server?

Read the documentation for the CGI.pm module. You could also do a search
on this group (using Google). This question has been answered multiple
times in the past.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top