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/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("attachedfile");
$uploaddir = "C:\\Temp"; #### on web server..
$temp = $uploaddir . $attachedFile;
open UPLOADFILE, ">$temp";
close UPLOADFILE;
print "$temp";
------------------------------------------------
Now I want to capture the file attachment from a user's desktop and
upload it into a temp variable on the web server. It is giving me zero
byte sized file in the $temp variable. What am I doing wroing here?
Can some boby kindly tell me how my perl code should be modified so
that I can store the $attachedFile from the user's desktop into $temp
variable on the web server?
One more thing is that I don't want to use filefield() from CGI.pm,
though my script has CGI module. The reason is that all filefield() is
doing is to create another file browse control, which I don' want.
Thanks in advance,
Srini
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/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("attachedfile");
$uploaddir = "C:\\Temp"; #### on web server..
$temp = $uploaddir . $attachedFile;
open UPLOADFILE, ">$temp";
close UPLOADFILE;
print "$temp";
------------------------------------------------
Now I want to capture the file attachment from a user's desktop and
upload it into a temp variable on the web server. It is giving me zero
byte sized file in the $temp variable. What am I doing wroing here?
Can some boby kindly tell me how my perl code should be modified so
that I can store the $attachedFile from the user's desktop into $temp
variable on the web server?
One more thing is that I don't want to use filefield() from CGI.pm,
though my script has CGI module. The reason is that all filefield() is
doing is to create another file browse control, which I don' want.
Thanks in advance,
Srini