]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/attachment.pm
explicitly set form type to multipart
[git.ikiwiki.info.git] / IkiWiki / Plugin / attachment.pm
index 53d826178891a901bb1750949d2abaf638bcc693..84bf643905f75dccf9122dc4a91bbfc201cc7079 100644 (file)
@@ -21,6 +21,8 @@ sub formbuilder_setup (@) { #{{{
        my $q=$params{cgi};
 
        if (defined $form->field("do") && $form->field("do") eq "edit") {
+               # Add attachment field, set type to multipart.
+               $form->enctype(&CGI::MULTIPART);
                $form->field(name => 'attachment', type => 'file');
                # These buttons are not put in the usual place, so
                # are not added to the normal formbuilder button list.
@@ -88,8 +90,8 @@ sub formbuilder (@) { #{{{
                # of the temp file that CGI writes the upload to.
                my $tempfile=$q->tmpFileName($filename);
                
-               if (! defined $tempfile) {
-                       error("failed to determine temp filename");
+               if (! defined $tempfile || ! length $tempfile) {
+                       error("failed to determine tempfile name");
                }
 
                $filename=IkiWiki::titlepage(