]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/attachment.pm
attachment: Support old versions of CGI.pm that lack an upload method.
[ikiwiki.git] / IkiWiki / Plugin / attachment.pm
index 90e0f0f0b1e7b8e419cf1d1679d751d10a8e54b6..f4f64b46a54ec9ad574cebf3b7715080d0882343 100644 (file)
@@ -133,7 +133,11 @@ sub formbuilder (@) { #{{{
                else {
                        my $fh=$q->upload('attachment');
                        if (! defined $fh || ! ref $fh) {
-                               error("failed to get filehandle");
+                               # needed by old CGI versions
+                               $fh=$q->param('attachment');
+                               if (! defined $fh || ! ref $fh) {
+                                       error("failed to get filehandle");
+                               }
                        }
                        binmode($fh);
                        writefile($filename, $config{srcdir}, undef, 1, sub {