I'm am unable to upload attachments in the TWiki when I use the Google Chrome web browser.
When I go to attach a file to a TWiki page, no matter which file I choose to upload, the TWiki concatenates the file's directory path to "C:/fakepath/..."
I'm using Google Chrome version 16.0.912.75m with Windows XP SP3.
--
TWiki:Main/LisaTanguay - 2012-01-13
A quick Google search shows related issues with HTML/HTML5 compatibility:
Some research is needed.
--
TWiki:Main.PeterThoeny - 2012-01-13
I do not have the environment handy to test, could you apply this patch of
twiki/templates/attach.pattern.tmpl
to verify? Patched file
attach.pattern.tmpl is also attached.
--- attach.pattern.tmpl.save1 2010-06-14 23:41:41.000000000 -0700
+++ attach.pattern.tmpl 2012-01-13 15:06:17.000000000 -0800
@@ -61,7 +61,7 @@
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;
+ var v = obj.value.replace( /.*[\/\\]/, "" );
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(){
--
TWiki:Main.PeterThoeny - 2012-01-13
Actually, before you try
attach.pattern.tmpl
please patch
twiki/lib/TWiki/UI/Upload.pm
as follows to test the cleanup of file path on the server side:
--- lib/TWiki/UI/Upload.pm (revision 22486)
+++ lib/TWiki/UI/Upload.pm (working copy)
@@ -227,6 +227,7 @@
# below - @upload_objs are array of TWiki::Request::Upload objects
my @fileNames = grep { defined $query->{uploads}{$_} }
+ map { s/.*[\/\\]//; $_ }
map { $query->param("filepath$_") } ( '', 1 .. 9 );
my @upload_objs = @{ $query->{uploads} }{@fileNames};
In case you are not familiar how patch works, edit
twiki/lib/TWiki/UI/Upload.pm
, go to line 230 and add above line indicated by the plus sign (but remove the plus sign).
Once you verified that this works, please use the new
attach.pattern.tmpl
to verify that the
C:/fakepath/
is gone from the files listed below the file input field.
--
TWiki:Main.PeterThoeny - 2012-01-13
I found a Chrome with Win 7. I could verify the issue for file display (files listed below the file input field), however upload succeeded. After applying both patches, the display is correct too.
I patched twiki.org. Could you test in the Sandbox web on twiki.org if fixed with your browser?
--
TWiki:Main.PeterThoeny - 2012-01-13
This is now implemented in SVN trunk and 5.1 branch.
--
TWiki:Main.PeterThoeny - 2012-01-13
It looks like this fix introduced a new TWiki bug when using IE-8,
Item6854.
--
TWiki:Main.PeterThoeny - 2012-03-04