Gossamer Forum
Home : General : Perl Programming :

Form Script that allows file uploads?

Quote Reply
Form Script that allows file uploads?
Hi,

I'm currently using formmail.pl from Matt's Script Archive and whilst it's done the job perfectly so far, it doesn't support file field (uploads).

I want to allow people to fill-out a form and attach a small file for reference - can anyone recommend a form-script that can do this?

All the best
Shaun
Quote Reply
Re: [qango] Form Script that allows file uploads? In reply to
Just do something like...

HTML..
Code:
<INPUT TYPE="FILE" NAME="nfile">
<INPUT TYPE="text" name="dir" value="/dir/to/upload/to">

CGI..
Code:
use CGI;
$cgi = new CGI;
$dir = $cgi->param('dir');
$nfile = $cgi->param('nfile');


$nfile=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
open(LOCAL, ">$dir/$nfile");
while(<$nfile>) {
print LOCAL $_;
}
close(LOCAL);
-------------
Jeremy
http://lc.crashinto.com - Crashinto Learning Central

Last edited by:

nolimit: Oct 22, 2001, 3:16 AM
Quote Reply
Re: [qango] Form Script that allows file uploads? In reply to
http://www.wiredon.net/form/
Quote Reply
Re: [RedRum] Form Script that allows file uploads? In reply to
Hey Pall,
you must realy hate using closing table tags, because you keep leaving them out of your pages, or maybe you just don't like Netscape users.Unimpressed

Bob
http://totallyfreeads.com
Quote Reply
Re: [lanerj] Form Script that allows file uploads? In reply to
Nuts....sorry about that - I whipped up that page quickly the other day when I realised the form mailer was worth releasing and forgot a few tags :(

Should be fixed now - let me know - thanks for pointing it out.
Quote Reply
Re: [nolimit] Form Script that allows file uploads? In reply to
Thanks for the replies:

I'll try Jeremy's mod first to see if I can get it working with formmail, if not I'll have a look at your form script Paul (ps. Is there a REDIRECT option for your form script Paul?)

All the best
Shaun
Quote Reply
Re: [qango] Form Script that allows file uploads? In reply to
Quote:
Is there a REDIRECT option for your form script Paul?

There will be in about 30 mins :)
Quote Reply
Re: [RedRum] Form Script that allows file uploads? In reply to
Uh...You don't print a text header anywhere in your main routine, therefore when you run setup it merely displays the text of the script...This from the version just downloaded minutes ago.

easy does it
Quote Reply
Re: [Bearwithme] Form Script that allows file uploads? In reply to
Everyone who has used setup.cgi has said it works great Unimpressed

Last edited by:

RedRum: Oct 23, 2001, 6:36 AM
Quote Reply
Re: [Bearwithme] Form Script that allows file uploads? In reply to
I do mention on the download page that it's a beta and there are still a few bugs but I've added a header just for you and updated the download Cool

Last edited by:

RedRum: Oct 23, 2001, 6:32 AM