I have a form that I want to upload photos with. I can make it work perfectly with one file, but I want them to be able to add multiple files and when I try that the files get saved but with 0 bytes. (FYI - I am using Mason)
<input type="file" name="file_1">
<input type="file" name="file_2">
<input type="file" name="file_3">
And then to process the submission of the files...
if ($fileList[0]) {
my $uploadCnt = 3;
my $fileCnt = 1;
for (;$fileCnt<=$uploadCnt;$fileCnt++) {
my $upfile = $ARGS{"file_$fileCnt"};
### this passes the file to the mason component I created
+to upload files
my $fileRef = $m->comp("fileUploader.mas",upload_file=>$up
+file);
}
}
Whereas with just one file, I just send the file_1 directly to my uploader, like so:
my $fileRef = $m->comp("fileUploader.mas",upload_file=>$file_1);
When I do a Data::Dumper (print Dumper(\$upfile)) it just has the file name in there. Is there a default folder on the server the files are being stored at temporarily that I can just prepend to that file and move it? I am not sure what is happening and what to do to fix it. Any suggestions?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.