upload(\"fileInput\");\" is always empty even when \"my $file = $query" />
开发者

Unable to upload web page

开发者 https://www.devze.com 2023-03-27 01:18 出处:网络
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

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 to enctype="multipart/form-data"
0

精彩评论

暂无评论...
验证码 换一张
取 消