CGI file upload missing from STDIN

M

Mark

Hello.

I am beginning to experiment with HTML forms and CGI.
I have an HTML form that uploads a file using the
multipart/form-data encoding and the POST method.
The form target is a simple Perl script which opens a file and
writes out the data that it received via STDIN.

The output file shows all the various inputs from my
HTML form, except for the file stream. Any idea
why the file isn't showing up?

Of course, I will use the CGI module for any
serious work.

Thanks
-Mark
 
U

usenet

Mark said:
The output file shows all the various inputs from my
HTML form, except for the file stream. Any idea
why the file isn't showing up?

Because your code is buggy. But we can't really help you, since you
didn't show us your code!
 
B

Bengt-Arne Fjellner

Because your code is buggy. But we can't really help you, since you
didn't show us your code!

As there is VERY little data i can just guess.
how does your form tag look? it should be "multipart/form-data" to work
<form method="post" action="/cgi-bin/pars" enctype="multipart/form-data">
 
K

Keith Keller

But if I show you my code, you might mock me.

Is it better to be mocked but get specific help, or to be mocked but get
no help?

If you post a short-but-complete script replicating the problem, with
use strict and use warnings, then there shouldn't be too much to mock
you over.

--keith
 
A

A. Sinan Unur

But if I show you my code, you might mock me.

Your code will be critqued. It is up to you to decide whether getting help
with your problem is worth the hassle.

As it stands, it is not worth for us to waste time trying to help you.

Please see the posting guidelines for this newsgroup to learn how you can
help yourself, and help others help you.

Sinan
 
G

Gunnar Hjalmarsson

Mark said:
I am beginning to experiment with HTML forms and CGI.
I have an HTML form that uploads a file using the
multipart/form-data encoding and the POST method.
The form target is a simple Perl script which opens a file and
writes out the data that it received via STDIN.

The output file shows all the various inputs from my
HTML form, except for the file stream. Any idea
why the file isn't showing up?

Of course, I will use the CGI module for any
serious work.

Try the CPAN module CGI::UploadEasy. Among other things, it helps you
detect common mistakes in connection with file uploads.
 
M

Mark

Ok, I was editing my sample code for posting purposes,
and I discovered that the file input statement preceded my
opening FORM tag. Problem solved (buggy HTML form.)

Having a bunch of people telling me to look at my code
again was, in fact helpful. Thank you!

-Mark
 
M

Mark

Gunnar Hjalmarsson said:
Try the CPAN module CGI::UploadEasy. Among other things, it helps you
detect common mistakes in connection with file uploads.

Good suggestion, thanks. Yes, I will definitely use the CGI:: module
if I proceed with this. So far I just wanted to do something educational
(which it was), and produce a quick proof-of-concept for a client.

-Mark
 
U

usenet

Mark said:
Ok, I was editing my sample code for posting purposes,
and I discovered [the problem]

I've done that many times! If you post according to the guidelines,
you will often discover your answer before you even post the question.

Cheers.
 
G

Gunnar Hjalmarsson

Mark said:
Good suggestion, thanks. Yes, I will definitely use the CGI:: module
if I proceed with this.

Well, CGI::UploadEasy isn't part of "the" CGI:: module (assuming you are
referring to Lincoln Stein's modules). But it does make use of CGI.pm
for parsing the upload request.
 
M

Mark

Mark said:
Ok, I was editing my sample code for posting purposes,
and I discovered [the problem]

I've done that many times! If you post according to the guidelines,

Please point me to the FAQ, and I will endeavor to post according
to the guidelines. Thanks.
you will often discover your answer before you even post the question.

Mmm. . .maybe. Maybe not. I have found that I can spend hours on a
problem by myself, but only arrive at an answer once I have asked
someone else about it. I may just have to air a dumb bug in public
before I find it (or someone else finds it.)

-Mark
 
A

A. Sinan Unur

Mark said:
Ok, I was editing my sample code for posting purposes,
and I discovered [the problem]

I've done that many times! If you post according to the guidelines,

Please point me to the FAQ, and I will endeavor to post according
to the guidelines. Thanks.

The FAQ is installed on your system:

perldoc perlfaq

The posting guidelines are posted here regularly. There is a link to the
HTML version in my sig.
Mmm. . .maybe. Maybe not. I have found that I can spend hours on a
problem by myself, but only arrive at an answer once I have asked
someone else about it. I may just have to air a dumb bug in public
before I find it (or someone else finds it.)

And, for them to be able to do that, they need to see the buggy code in
question.

Sinan
 

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,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top