homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

uploading Files via PL script

 2:52 pm on Dec 7, 2001 (gmt 0)

I am using an HTML form along with a file upload input box. Normally I would use a PL script to parse the form and mail the information.

I was hoping this would work with the file as well, perhaps as an attachment, but it doesn't seem to.

The guide file suggests that if uploading files I should point the action of the form to an FTP site, but what about the rest of the information in the form?

Does anyone have a suggestion about this bit of technology?




 4:14 pm on Dec 7, 2001 (gmt 0)

What script are you using to collect the file from the form? I can't say 100% that this is workable with all scripts but I have had success with forms with fields and upload combined as in
Where to upload script? SELECT BOX
File to upload: FILE INPUT
Given that it works with one extra field, there's nothing in the cgi spec that limits file uploads to being solitary creatures in forms. Maybe the script itself is just limited? Did you get it from somewhere or write it yourself?

Sending the file as an attachment would require the file to be uploaded first to the server and then sent as an attachment from whatever mail program is installed. (Which would result in a leftover temp file if you use cgi.pm for the upload) The bit about setting the form action to an FTP server, I have never heard or seen done. There would have to be something (the script most cases) to actively take the file and feed it to the FTP server once it was logged in etc.

I would just write a perl script to upload the file after it extracts the extra form data and then send the file via email or maybe just send an email notice that a file was upload and have the perl script automagically update a "uploaded files" page on the site.


 4:38 pm on Dec 7, 2001 (gmt 0)

Thanks for writing.

I'm using the Formmail.pl from Matt's script Archive.

So the file upload idea is much more complicated than I was thinking.

I looked through the script code and didn't see anything that resembled an upload routine.

My perl is very limited. Perhaps I can find a script that already does this and I can modify it.

Thanks again.


 8:02 pm on Dec 7, 2001 (gmt 0)

It's not that complicated. I didn't even think twice about doing a file upload with other form fields. I just took the code I wrote before for the file upload and slapped it into the pl file and extracted the top value out. Matter of fact if you search for an upload file script or tutorial, most of those treat it the same way. All it would require would be merging the email parts, simplistic if you have sendmail or an equiv email program on the server. And to make it even simpler if you just email that a file was uploaded and have it update a semi-static page where you can view the uploaded file. Course all that assumes you can do some basic perl. I would start with looking for a file upload script and altering it to do the mail routine over the way you're looking at it now.



 10:28 pm on Dec 7, 2001 (gmt 0)

Thanks again series - I looked for an existing file and found one called formmailx.pl which adds attachments to e-mails.

I studied the code and it looks straightforward.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved