[Home]WikiBugs/FileUploadFails

UseModWiki | WikiBugs | RecentChanges | Preferences

Will fix for 1.1 (possibly as config option).
I had to make the following change to the SaveUpload? method to get it working on my site. I don't know enough to say whether or not we have a non-standard CGI implementation.

Original

  $filename = $q->param('file');
  $filename =~ s/.*[\/\\](.*)/$1/;  # Only name after last \ or /
  $uploadFilehandle = $q->upload('file');

Changed

  $filename = $q->param('file');
  $uploadFilehandle = $filename;
  $filename =~ s/.*[\/\\](.*)/$1/;  # Only name after last \ or /

Our CGI.pm indicates that the returned value from param can be used as a file handle. Also, our CGI.pm does not implement an upload method.

If your CGI.pm does not implement an upload method, then it is probably pretty old. (The system I am using has a 2 year old Perl with the upload method.) Still, the suggested fix might work for other people. --CliffordAdams

You're correct about age. Our CGI.pm is version 2.43, dated October, 1998. --JamesHodge?

As another data point, had to make the same change for our installation at work. RedHat 7.3 apparently comes with 2.46. --MikeCastle


I plan to fix this for 1.1, probably as a configuration option. (I can wrap the $q->upload code in an eval statement so that it doesn't crash the script if the upload method doesn't exist.) --CliffordAdams

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 5, 2003 5:58 pm by CliffordAdams (diff)
Search: