I am trying to upload a file from a web page. I use CGI to query for all of the input fields but "my $upload_filehandle = $query->upload("fileInput");" is always empty even when "my $file = $query->param("fileInput");" has properly fetched the file name from the same field. Here is the code:
use CGI;
$CGI::POST_MAX = 1024 * 5000;
my $query = CGI->new;
my $url = $query->param("urlInput");开发者_开发问答
my $file = $query->param("fileInput");
my $upload_filehandle = $query->upload("fileInput");
my $text = $query->param("textInput");
my $k = $query->param("kInput");
Any advice is appreciated.
Regards.
I will repost my comment, as an answer:
- make sure your HTML form contains the
enctype
attribute, and that it's set toenctype="multipart/form-data"
精彩评论