create new tag
, view all tags

SID-00861: Can't Attach files, TWiki thinks max upload files exceeded

Status: Answered Answered TWiki version: 5.0.0 Perl version: 5.10.0
Category: CategoryAttachments Server OS: RedHat Linux 11 64-bit Last update: 6 years ago

Just recently upgraded our TWiki from 4.2.1 to 5.0.0.

On the Attach page for any given TWiki article, the page is set up to do only one attachment at a time by default, as expected. By this, I mean there is only one text field(for the file name and location) and one button that says "Browse."

However, as soon as a user clicks on "Browse", selects just one file, and clicks on "Open," 10 text fields and 10 "Browse" buttons appear, and below them is the same file listed 10 times with little tiny red "x"s to the right of each one. Also, I get a Windows popup that says "Max files is 10."

At this point, one of two things happen depending on the action. 1)If the user clicks on the "Upload File" button immediately after doing the above, the file is uploaded only 1 time despite being listed 10 times on the Attach page. 2)If the user removes all but 1 of the files by clicking on the little red "x" button next to each file, and then the user clicks on "Upload File," the user is redirected back to the TWiki article and the file was never attached.

Once, after clicking on the "Upload File" button, the TWiki redirected us to a page that said, "Can't call method "binmode" on an undefined value at /var/www/twiki/lib/TWiki/Request/Upload.pm line 97." I'm not sure if this happened after we did action number 1 or action number 2 listed in the previous paragraph, so I apologize.

I have not messed with any of the multiple file upload configurations so max file upload should be default, which I assume is 10.

TWiki logs did not report anything except for the binmode error I mentioned above.

-- LisaTanguay - 2010-06-08

Discussion and Answer

How did you upgrade? Install new TWiki over existing TWiki, or complete fresh install? If installing over existing TWiki there might be version conflicts of files.

-- PeterThoeny - 2010-06-08

Thanks for the reply.

I upgraded from version 4.2.1 to 5.0.0. In thinking that it may have been an upgrade issue, I installed a fresh copy of version 5.0.0 elsewhere on our Apache server but the attachment issue still remains.

However, I just recently discovered that the attachment page works perfectly fine on one of our networks(Network A), but not the other(Network B). Most of our users use Network A over the the other, but the Apache server is hosted on Network B and can only be accessed by users on Network A or B in our building or through VPN. Previously, there were no issues on either network when using TWiki version 4.2.1.

Now, this most likely means that the attachment problem has something to do with Network A, or possibly with Apache configurations, so I intend to do a little more poking and prodding to see if anything comes up, but if you have any ideas, please let me know. I'll reply soon enough with my results.


-- LisaTanguay - 2010-06-10

I am seeing exactly the same issue on Ubuntu 8.04 lts with perl 5.8.8 on apache 2.2.

Hope this helps, please let me know if i can provide any more info from my installation.

-- JulianCollins - 2010-06-14

This is likely a browser/JavaScript related issue. What browser/version are you using?

Is JavaScript enabled? Can you test with different browsers?

I created TWikibug:Item6492 to track this.

-- PeterThoeny - 2010-06-14

Also, what kind of skin are you using? If not standard skin, for testing could you revert to: * Set SKIN = tagme,topmenu,pattern

If you have your own skin, make sure to load the JQuery library in the HTML head section of your skin:

<link rel="stylesheet" href="%PUBURLPATH%/TWiki/JQueryPlugin/jquery-all.css" type="text/css" media="all" />
<script type="text/javascript" src="%PUBURLPATH%/TWiki/JQueryPlugin/jquery-all.js"></script>

-- PeterThoeny - 2010-06-14

I am using the Standard skin, and have done no customisation at all.

I have tested on various browsers, The failures only occur with IE

  • IE6 - Fail
  • IE8 - Fail
  • Safari 5.0 - Pass
  • Google Chrome 5.0.375 - Pass
  • Firefox 3.63 - Pass

Lisa - Is the browser different between your 2 networks?

Peter - please let me know if there are any more tests you would like me to do.

-- JulianCollins - 2010-06-15

OK, I found a Windoze machine with IE8 and can reproduce it:


Thanks for reporting! Now some debugging is needed.

-- PeterThoeny - 2010-06-15

See patch below and updated twiki/templates/attach.pattern.tmpl

--- attach.pattern.tmpl.save1   2010-06-14 21:58:02.000000000 -0700
+++ attach.pattern.tmpl 2010-06-14 23:41:41.000000000 -0700
@@ -40,7 +40,39 @@
 </div><!-- /twikiFormStep-->%TMPL:P{"changepropertiesaction"}%%TMPL:END%

-<script type="text/javascript"> $(document).ready(function(){  var fileMax = 10; $('#attachlist').after('<div id="files_list"></div>'); $("input.upload").change(function(){ doIt(this, fileMax); }); });   function doIt(obj, fm) { if($('input.upload').size() > fm) {alert('Max files is '+fm); obj.value='';return true;} var fileNo = $('input.upload').size(); $(obj).hide(); $(obj).parent().prepend('<input type="file" class="upload" name="filepath'+fileNo+'" value ="%FILEPATH%" size="50" />').find("input").change(function() {doIt(this, fm)}); var v = obj.value; if(v != '') { $("div#files_list").append('<div>'+'<input type="image" src="%ICONURL{remove}%" width="12" height="12" border="0"  alt="Remove file" title="Remove file" value="" style="margin:-2px 0px 0px 0px; border:none; padding:0px; width:12px; height:12px; background-color:transparent;" />  '+v+'</div>') .find("input").click(function(){ $(this).parent().remove(); $(obj).remove(); return true; }); } }; </script> %TMPL:END%
+<script type="text/javascript">
+  function(){
+    var fileMax = 10;
+    $('#attachlist').after('<div id="files_list"></div>');
+    $("input.upload").change(
+      function(){
+        doIt(this, fileMax);
+      }
+    );
+  }
+function doIt(obj, fm) {
+  if($('input.upload').size() > fm) {
+    alert('Max files is '+fm);
+    obj.value='';
+    return true;
+  }
+  var fileNo = $('input.upload').size();
+  $(obj).hide();
+  $(obj).parent().prepend('<input type="file" class="upload" name="filepath'+fileNo+'" value="" size="50" onchange="doIt(this, '+fm+');" />');
+  var v = obj.value;
+  if(v != '') {
+    $("div#files_list").append('<div>'+'<input type="image" src="%ICONURL{remove}%" width="12" height="12" border="0"  alt="Remove file" title="Remove file" value="" style="margin:-2px 0px 0px 0px; border:none; padding:0px; width:12px; height:12px; background-color:transparent;" /> '+v+'</div>').find("input").click(
+      function(){
+        $(this).parent().remove();
+        $(obj).remove();
+        return true;
+      }
+    );
+  }
+</script> %TMPL:END%


Please let me know if this fixes the issue.

-- PeterThoeny - 2010-06-15

The other bug Lisa mentioned is tracked at TWikibug:Item6494: Attach/remove/attach gives error: Can't call method "binmode" on an undefined value.

-- PeterThoeny - 2010-06-15

I have tested this patch, I can now upload succesfully in IE8. Thanks for the speedy response.

-- JulianCollins - 2010-06-15

I am glad it worked out! I updated the KnownIssuesOfTWiki05x00 page.

-- PeterThoeny - 2010-06-16

Great! Thanks for the multiple attachments patch.

I apologize for not replying sooner, but I was on business travel for the past two weeks and had limited access to the internet. As it turns out, it definitely was an IE8 issue, and I was so caught up with configuring Apache that I didn't even think to test the web browsers. Thank you so much!

-- LisaTanguay - 2010-06-30

Having issues attaching file to TWiki Using Twiki version 5.0.2. This was installed on top of a previous version( 4.2 ) Get the error msg -> Can't locate object method "binmode" via package "IO::File" when trying to Upload a file. Saw your fix for the Request/Upload.pm and my sub handle function has your fixes. The problem is reproducible with IE(8) and Firefox(5)

-- JyotirmoySharma - 2011-07-12

This is probably due to an outdated CPAN:IO::File library. Update the library. Also, best to open a new support question for each question.

-- PeterThoeny - 2011-07-12

Thanks. The upgraded IO::File library solved the problem.

-- JyotirmoySharma - 2011-07-12

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Status Answered
Title Can't Attach files, TWiki thinks max upload files exceeded
SupportCategory CategoryAttachments
TWiki version 5.0.0
Server OS RedHat Linux 11 64-bit
Web server Apache HTTPD 2.2
Perl version 5.10.0
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formattmpl attach.pattern.tmpl r1 manage 4.2 K 2010-06-15 - 06:55 PeterThoeny  
PNGpng ie-attach.png r1 manage 9.5 K 2010-06-15 - 04:41 PeterThoeny  
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2011-07-12 - JyotirmoySharma
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.