Hi Fellow Monks,

Hi!

I'm a bare novice, so please bear with me.

Okay, turning off flamethrower. As a tip, when asking for help, you should try to:

  1. Be very specific about what you are trying to do
  2. Either post the code you attempted to use, or explain why you have no code.
  3. Be very specific about what happens when something "doesn't work".
  4. Always have use strict; in your program, and have a -w as a command line option, such as #!/usr/bin/perl -w. If you're writing a web script, have #!/usr/bin/perl -wT
In some areas, notable some Perl Usenet newgroups, you can get some very vicious comments if you don't.

I need a subroutine that would allow me to upload several images and write some input to a text file all at once.

Okay. There are multiple issues here.

  1. Writing to a text file

    This is easily done in perl. Check out the documentation for open, close, and print.

  2. Uploading files

    Here is an instance of not being specific about the problem. "Uploading" can happen various ways. I'll assume you mean via a Web page, but if you don't, please clarify.

    As mentioned, you should use the CGI.pm module. If you aren't familiar with using modules, you should learn, as it is the single best time saver in perl (and there are a lot). A good place to start is perlmodlib.

    The documentation for CGI.pm is a bit...rambling. If you're familiar with HTML, I'd recommend you skip the sections describing HTML-generating functions for now. You'll want to look at the param(), header(), and upload() functions. Also notice that you need to properly set the enctype field for your form (details in the CGI documentation).

You may want to look at the thread File Upload to Selected Directory. Be sure to read the responses, they contain good security information.

In reply to Re: Uploading and writing to a text file by swiftone
in thread Uploading and writing to a text file by Stamp_Guy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.