File upload via web form
File upload via web form
(OP)
I've been trying to do a file upload via a web form so that a user can post a file to a web directory from a web form. I've banged my head against javascript for a while and no luck (I think due to security). I've seen plain form submissions to a directory via a web form using perl, can I also use it to post a file to the same directory (much like a bulliten board)? Any help would be most appreciated as my perl skills are not up to par for web programming...
Thanks,
-Eric
Thanks,
-Eric
RE: File upload via web form
Well, being new to Perl, and presently wtill working on honing my JavaScript, dHTML, and now HTML 5.0 skills I can't help you much with the Perl part of this. BUT I can give you the HTML that you'll need for it:
(inside your <form> and </form> tags put the following where you'd like to allow users to do their file upload):
<input type=file>
(and if you really want to make things a little easier on your clients, e-mail me,and I can design you a JavaScript to check thier http file uploading capabilities)
-Robherc
RE: File upload via web form
I haven't tried it myself, but the documentation should provide an example or two (man perlcgi or man CGI, I can't remember which)
Milamber
RE: File upload via web form
I have been working with perl for sometime now,
What you will need is a form with a <input type='file' name='blah'> in it and this submitting to a cgi where you need to get the value of the input field and run this command:
while ($size = read($upload_file,$buffer,1024)) {
print FILE $buffer;
$total_size = $size;
}
The variable $upload_file is the value of the input field from the previous form, you may find that you have some problems with this but just make sure that your permissions are set so that the httpd user can write to the directory you are trying to write to. BTW FILE is a filehandle for the location that you are trying to write to.
If you want more info drop us an email.
RE: File upload via web form
'hope this helps...
keep the rudder amid ship and beware the odd typo
RE: File upload via web form
HTH
keep the rudder amid ship and beware the odd typo