1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    31
    Vote Rating
    1
    zeke is on a distinguished road

      0  

    Default Unanswered: Removing 'fakepath' from fileuploadfield in 4.1.1

    Unanswered: Removing 'fakepath' from fileuploadfield in 4.1.1


    Is there a good way to remove the 'fakepath' stuff from the displayed value in a file upload field so instead of something like "c:\fakepath\myfile.txt" it displays only the filename (myfile.text) instead?

    I thought I might be able to do this through setValue but it doesn't do anything any more, for good reason I'm sure.

    Also, not sure if this is frowned upon, but in using the new forum search functionality (which I really like btw!) it looks like this question may have been asked in the premium forums: http://www.sencha.com/forum/showthread.php?240197

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,112
    Answers
    678
    Vote Rating
    470
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You would have to display the path yourself. The browser add fakepath this as a security feature.

    Scott.

  3. #3
    Sencha User
    Join Date
    Oct 2008
    Posts
    31
    Vote Rating
    1
    zeke is on a distinguished road

      1  

    Default


    Adding the following to the fileuploadfield config is working for me:

    Code:
    listeners: {
        change: function(f,v){
            var node = Ext.DomQuery.selectNode('input[id='+f.getInputId()+']');
            node.value = v.replace("C:\\fakepath\\","");
        }
    },

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    4
    Vote Rating
    0
    louisthach is on a distinguished road

      0  

    Default


    Quote Originally Posted by zeke View Post
    Adding the following to the fileuploadfield config is working for me:

    Code:
    listeners: {
        change: function(f,v){
            var node = Ext.DomQuery.selectNode('input[id='+f.getInputId()+']');
            node.value = v.replace("C:\\fakepath\\","");
        }
    },
    Thanks Zeke, this really works for me too.