Stetec has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that if I do any request before submit and add any number of attachments it does not get the attachment from request and the error message is pushed into array and displayed. It does not push the error message only if I restart apache service and submit the form right after it. Any ideas what can cause this? I posted this also on stack overflow but no-one is able to help. Here is a link to it https://stackoverflow.com/questions/48290475/getting-attachment-from-request-in-perl<!DOCTYPE html> <html> %foreach (@messages) { <div class="alert"> <% $_ | h %> </div> %} <body> <form action="/Tools/SendEmail.html" name="form" enctype="multi +part/form-data" method=post> <input type="checkbox" id="submited_chck" name="submited" +checked hidden> <input type="file" name="attached_files" id="file_upload_b +tn" multiple> <input type="submit" value="Submit"> </form> </body> </html> <%args> @messages => () $submited => '' </%args> <%init> use strict; use warnings; use CGI; if($submited eq 'on') { my $req = new CGI; my @attachments = $req->param('attached_files'); unless (@attachments) { push @messages, "Attachments do not exist"; } } </%init>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting attachments from request in perl
by Stetec (Novice) on Jan 19, 2018 at 13:03 UTC | |
|
Re: Getting attachments from request in perl
by Anonymous Monk on Jan 18, 2018 at 15:31 UTC | |
by Stetec (Novice) on Jan 18, 2018 at 16:21 UTC | |
by johngg (Canon) on Jan 18, 2018 at 18:15 UTC | |
by Stetec (Novice) on Jan 18, 2018 at 23:23 UTC |