Aaron Saray

open source programmer,
web developer

entrepreneur, author
and musician

My Blog

contains PHP, Web and business/entrepreneurial related content. Please join in the conversation!

Fixing c:\fakepath in filestyle jquery plugin

The other day I ran across an issue with the FileStyle jquery plugin. Whenever a new file was chosen, windows and Internet Explorer would put c:\fakepath\ before the filename. Turns out its not FileStyle’s issue – but a security feature of Internet Explorer.

As a quick fix, however, I made the following changes to FileStyle:

BEFORE

?View Code JAVASCRIPT
1
2
3
4
5
6
//snip
            $(self).bind("change", function() {
                filename.val($(self).val());
            });

//snip

AFTER

?View Code JAVASCRIPT
1
2
3
4
            $(self).bind("change", function() {
                var s = $(self).val().replace(/(c:\\)*fakepath/i, '');
                filename.val(s);
            });

This entry was posted in javascript, jquery and tagged , . Bookmark the permalink.

4 Responses to Fixing c:\fakepath in filestyle jquery plugin

  1. Martijn says:

    Thanks, just what I was looking for. Small note: this problem isn’t IE specific, it also occurs in Chrome.

  2. Daniel says:

    Perfect! Thanks!

  3. Cristina says:

    Thanks a lot, you’ve saved my life

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>