Perl/CGI file upload

J

Jerome

Hi!

I am in need of a special file upload script using Perl.

The script needs to allow uploading any files from a form (without
knowing the form structure in advance) - basically *any* files given
to it.

I just need some short documented source code as a hint so that I can
go and do the rest of the research, but so far I found nothing which
handles forms without knowing the forms themselves.

Thanks!

-gratemyl
 
J

Joe Smith

Jerome said:
The script needs to allow uploading any files from a form (without
knowing the form structure in advance) - basically *any* files given
to it.

Why? Are you willing to accept totally random and inappropriate content?

To properly deal with a form submission, the CGI needs to know what
to expect. If you have several forms, each of which can upload files,
then you should have several programs (or bits of a combined program),
each of which can use common code to deal with the shared task of file uploads.

-Joe
 
J

Jerome

Why? Are you willing to accept totally random and inappropriate content?
Yes


To properly deal with a form submission, the CGI needs to know what
to expect. If you have several forms, each of which can upload files,
then you should have several programs (or bits of a combined program),
each of which can use common code to deal with the shared task of file uploads.

-Joe
 
K

Keith Keller

I am in need of a special file upload script using Perl.

What have you written so far?
I just need some short documented source code as a hint so that I can
go and do the rest of the research, but so far I found nothing which
handles forms without knowing the forms themselves.

Start with perldoc CGI, and look for the upload() function. I think
it's an exceedingly bad idea to do what you're trying to do, however.

--keith
 
J

Jerome

What have you written so far?


Start with perldoc CGI, and look for the upload() function. I think
it's an exceedingly bad idea to do what you're trying to do, however.

I have looked at the upload function, but as far as I see it requires
me to specify a field name - I need to do this for all fields of
"type" file.

I understand this is a strange requirement, but it is the way things
are.

Thanks again!
 
K

Keith Keller

I have looked at the upload function, but as far as I see it requires
me to specify a field name - I need to do this for all fields of
"type" file.

Okay...so now look for "FETCHING THE NAMES OF ALL THE PARAMETERS
PASSED TO YOUR SCRIPT:". And please try to do at least some of your own
work yourself; that's all the pointers you're getting from me, at least,
until you show some of your own effort.

Have you read the Posting Guidelines that are posted here frequently?

--keith
 
J

Jerome

Okay...so now look for "FETCHING THE NAMES OF ALL THE PARAMETERS
PASSED TO YOUR SCRIPT:". And please try to do at least some of your own
work yourself; that's all the pointers you're getting from me, at least,
until you show some of your own effort.

Have you read the Posting Guidelines that are posted here frequently?

--keith

--
(e-mail address removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

That pointer was brilliant, thanks a lot! I think I figured it out now!
 
G

Gunnar Hjalmarsson

Jerome said:
The script needs to allow uploading any files from a form (without
knowing the form structure in advance) - basically *any* files given
to it.

Check out the CPAN module CGI::UploadEasy.
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top