Results 1 to 5 of 5

Thread: Removing 'fakepath' from fileuploadfield in 4.1.1

  1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    33
    Vote Rating
    2
      0  

    Default 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,389
    Answers
    716
    Vote Rating
    497
      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
    33
    Vote Rating
    2
      2  

    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
      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.

  5. #5
    Sencha User
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    0
      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\\","");
        }
    },

    A big thanks from here as well, Zeke: works for me too :-D

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •