CGI file upload missing from STDIN

Discussion in 'Perl Misc' started by Mark, Nov 28, 2005.

  1. Mark

    Mark Guest

    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
    Mark, Nov 28, 2005
    #1
    1. Advertising

  2. Mark

    Guest

    Mark wrote:
    > 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!
    , Nov 28, 2005
    #2
    1. Advertising

  3. Mark

    Mark Guest

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


    But if I show you my code, you might mock me.
    Mark, Nov 28, 2005
    #3
  4. <> wrote in
    news:...
    > Mark wrote:
    >> 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!
    >


    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">
    Bengt-Arne Fjellner, Nov 28, 2005
    #4
  5. Mark

    Keith Keller Guest

    On 2005-11-28, Mark <> wrote:
    ><> wrote:
    >> Because your code is buggy. But we can't really help you, since you
    >> didn't show us your code!

    >
    > 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

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
    see X- headers for PGP signature information
    Keith Keller, Nov 28, 2005
    #5
  6. "Mark" <> wrote in news:raadnS239uOhyBbenZ2dnUVZ_s-
    :

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

    >
    > 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
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Nov 28, 2005
    #6
  7. Mark wrote:
    > 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.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Nov 28, 2005
    #7
  8. Mark

    Mark Guest

    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
    Mark, Nov 28, 2005
    #8
  9. Mark

    Mark Guest

    "Gunnar Hjalmarsson" <> wrote:
    >
    > 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
    Mark, Nov 28, 2005
    #9
  10. Mark

    Guest

    Mark wrote:
    > 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.
    , Nov 28, 2005
    #10
  11. Mark wrote:
    > Gunnar Hjalmarsson wrote:
    >>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.


    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.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Nov 28, 2005
    #11
  12. Mark

    Mark Guest

    <> wrote:
    > Mark wrote:
    >> 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
    Mark, Nov 28, 2005
    #12
  13. "Mark" <> wrote in
    news::

    > <> wrote:
    >> Mark wrote:
    >>> 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.

    >> 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.)


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

    Sinan
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Nov 28, 2005
    #13
  14. Mark

    Paul Lalli Guest

    Paul Lalli, Nov 28, 2005
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnathan Doe

    peek at stdin, flush stdin

    Johnathan Doe, May 15, 2004, in forum: C Programming
    Replies:
    5
    Views:
    24,955
    Chatoyer
    May 17, 2013
  2. Charlie Zender

    Reading stdin once confuses second stdin read

    Charlie Zender, Jun 19, 2004, in forum: C Programming
    Replies:
    6
    Views:
    785
    Dan Pop
    Jun 21, 2004
  3. Ben
    Replies:
    2
    Views:
    1,343
    jacob navia
    Aug 29, 2009
  4. Terry Cooper
    Replies:
    7
    Views:
    424
    Janos Sebok
    Jun 9, 2009
  5. Stefano Sabatini
    Replies:
    6
    Views:
    291
    Stefano Sabatini
    Jul 29, 2007
Loading...

Share This Page