Closed thoraage closed 11 years ago
Thanks for the heads up. I only tested this in IE8 since I made a major change so I kind of assumed it would work in later versions (though I know that's never the case).
I will check this ASAP.
What version of jQuery are you running? This will only work for version 1.6 and higher. Thanks.
I use jquery v1.8.3. It works fine with firefox and chrome. It's only IE 9 (9.0.8112.16421) that's acting out.
On Mon, May 6, 2013 at 8:37 AM, grevory notifications@github.com wrote:
What version of jQuery are you running? This will only work for version 1.6 and higher. Thanks.
— Reply to this email directly or view it on GitHubhttps://github.com/grevory/bootstrap-file-input/issues/14#issuecomment-17468095 .
Thanks! I wanted to make sure there were truly an IE9 bug before I install a VM to test.
How about following code? It works fine on Chrome, FF, IE8-10,Lunascape(Webkit) and Chrome on Ubuntu 13.04.
$('.file-input-wrapper input[type=file]').change(function(){ var fileName; $(this).parent().next('.file-input-name').remove(); if ($(this).prop('files') && $(this).prop('files').length > 1) { $(this).parent().after(''+$(this)[0].files.length+' files'); } else { fileName = $(this).val(); if(fileName.indexOf('C:\fakepath\') > -1){ fileName = fileName.replace('C:\fakepath\',''); }else{ fileName = fileName.substring(fileName.lastIndexOf('\')+1,fileName.length); } $(this).parent().after(''+fileName+''); } });
Hi
There seems to be a problem with this (in IE, Chrome and possibly others).
The string literals with \ needs to be escaped with . Also when I try to upload again it will prepend the new name to the old one
On Wed, May 8, 2013 at 2:51 AM, tsukisu412 notifications@github.com wrote:
How about following code? It works fine on Chrome, FF, IE8-10,Lunascape(Webkit) and Chrome on Ubuntu 13.04.
$('.file-input-wrapper input[type=file]').change(function(){ var fileName; $(this).parent().next('.file-input-name').remove(); if ($(this).prop('files') && $(this).prop('files').length > 1) { $(this).parent().after(''+$(this)[0].files.length+' files'); } else { fileName = $(this).val(); if(fileName.indexOf('C:\fakepath\') > -1){ fileName = fileName.replace('C:\fakepath\',''); }else{ fileName = fileName.substring(fileName.lastIndexOf('\')+1,fileName.length); } $(this).parent().after(''+fileName+''); } });
— Reply to this email directly or view it on GitHubhttps://github.com/grevory/bootstrap-file-input/issues/14#issuecomment-17580345 .
I haven't had the chance to install a VM with IE9. Any chance you can test this fix? https://github.com/grevory/bootstrap-file-input/tree/523fb644b84fc52a28a46937158b7259cd439608
I can verify the above fix is working in IE9
Thank you!
I get the message:
Otherwise it seems to work well; the file is uploaded and everything.