How to Get Rid of C:fakepath in Ie When Uploading a File to the Website [fix]

  1. #1

    pegaso52it is offline

    Sencha Premium Member


    Default Answered: Chrome shows e'er "c:\fakepath\..." in upload field instead of the right path

    Hi I'thou using Chrome Version 27.0.1453.116 1000.

    I've a problem in my custom application using File Upload Field
    that happens also in online samples application.

    Use
    http://docs.sencha.com/extjs/4.2.1/e...le-upload.html

    Use the first example "Basic File Field", then click "Browse..." push and select the file you desire.
    The trouble is that in upload field the file name is right but the file path shows ever: c:\fakepath\...
    Also using the "Become File Path" push button under the upload field is shown the wrong path.

    And so the upload does not works correctly (due to wrong path, I imagine)

    With Firefox using the same example are at that place no trouble,

    Please, could someone help me to solve this problem?


  2. Best Reply

    Posted by existdissolve

    Quote Originally Posted by dtex-lab View Post

    As pegaso52it wrote

    in the official example at
    http://docs.sencha.com/extjs/4.2.1/due east...le-upload.html

    the problem exists

    so aught to do with extension done.

    from official case, delight fill the Bones File Field using the browse push you tin see that the fully qualified path name is starting with C:\fakepath and not the one really selected.

    and also in the case description information technology says
    "The file path reported by the getValue method volition"

    I read in docs that the setValue is "browser dependent",

    The goal is to know from which location of the customer the file is uploaded

    Anyway i confirm that upload is working anycase
    Probably if y'all are using that informtion for you logging... information technology is incorrect and I hold it is a trouble in some cases

    I understand the "problem" every bit stated, simply it's not really a trouble, at to the lowest degree not from an Ext JS perspective. JavaScript does not, and should not , have access to the customer'southward file system, so I'thousand not sure why anyone would think they should be able to get the full path to a file from a client's machine.

    Moreover, I can't understand why one would need that anyhow. You certainly don't need it to upload a file, and so the only reason would exist a nefarious i (or a misguided one that doesn't empathise how file uploads work).

    I would personally HATE to know that someone was tracking or logging the path to a file on my computer, and would never apply the site if I knew they were able to practice that. They tin can take no possible reason to need to know that, unless of course I am installing a program (non JavaScript, of course) in which I grant access to that kind of information.


  3. #2

    Default

    Quote Originally Posted by pegaso52it View Post

    Hi I'yard using Chrome Version 27.0.1453.116 m.

    I've a problem in my custom awarding using File Upload Field
    that happens also in online samples application.

    Apply
    http://docs.sencha.com/extjs/4.ii.1/e...le-upload.html

    Utilize the first example "Bones File Field", and then click "Browse..." push and select the file you want.
    The trouble is that in upload field the file name is right but the file path shows always: c:\fakepath\...
    Likewise using the "Get File Path" push under the upload field is shown the wrong path.

    Then the upload does not works correctly (due to incorrect path, I imagine)

    With Firefox using the same case are in that location no problem,

    Please, could someone assist me to solve this trouble?

    Cheque out the outset couple of paragraphs in the documentation for Ext.form.field.File: http://docs.sencha.com/extjs/4.2.1/#...orm.field.File

    The issue of getValue() is entirely browser-dependent.

    All the same, this should take nothing to do with the upload succeeding or declining, as it is the content of the form field, not the path, which is ultimately put in the mail to the server.

    I have several applications that do file uploads with Ext.form.field.File, so at that place may be an issue with your implementation if information technology is succeeding in i browser merely failing in some other. Can you lot share some of the lawmaking that is failing?


  4. #3

    pegaso52it is offline

    Sencha Premium Fellow member


    Default

    Hi, thank for your answer, first of all.
    Alibi me if I have non reply quickly, but I was very busy with other activities.

    That's my code that works using Firefox:

    Code:

    MY.Ext.form.MYFileUploadField = Ext.extend(Ext.ux.grade.FileUploadField,       {          bindListeners : role()          {             MY.Ext.grade.MYFileUploadField.superclass.bindListeners.call(this);             this.fileInput.on(                   {                      scope : this,                      modify : function()                      {                         var 5 = this.fileInput.dom.value;                         this.setValue(v);                         this.iFileInputHidden.dom.value = five;                         this.fireEvent('fileselected', this, five);                      }                   });          },           createFileInput : office()          {             MY.Ext.form.MYFileUploadField.superclass.createFileInput.call(this);             this.iFileInputHidden = this.wrap.createChild(                   {                      id : this.hiddenId,                      name : this.hiddenId,                      tag : 'input',                      type : 'hidden',                      value : ''                   });          }       });


  5. #iv

    Default

    Quote Originally Posted by pegaso52it View Post

    Hi, give thanks for your reply, outset of all.
    Alibi me if I have not answer apace, just I was very busy with other activities.

    That's my code that works using Firefox:

    Lawmaking:

    MY.Ext.form.MYFileUploadField = Ext.extend(Ext.ux.form.FileUploadField,       {          bindListeners : function()          {             MY.Ext.class.MYFileUploadField.superclass.bindListeners.call(this);             this.fileInput.on(                   {                      telescopic : this,                      modify : function()                      {                         var v = this.fileInput.dom.value;                          this.setValue(v);                         this.iFileInputHidden.dom.value = v;                         this.fireEvent('fileselected', this, v);                          }                   });          },           createFileInput : function()          {             MY.Ext.form.MYFileUploadField.superclass.createFileInput.call(this);             this.iFileInputHidden = this.wrap.createChild(                   {                      id : this.hiddenId,                      name : this.hiddenId,                      tag : 'input',                      type : 'hidden',                      value : ''                   });          }       });
    If y'all're depending on the flake bolded above (e.one thousand., the setValue()), it's not going to work consistently. Once more, if you read the docs (http://docs.sencha.com/extjs/iv.two.ane/#...orm.field.File) you'll encounter that setValue() and getValue() are not implemented the same for the File field every bit for other ExtJS form fields, because of the cross-browser implementation differences.


  6. #5

    dtex-lab is offline

    Ext JS Premium Member


    Default

    As pegaso52it wrote

    in the official example at
    http://docs.sencha.com/extjs/4.2.one/e...le-upload.html

    the problem exists

    and so nil to practise with extension done.

    from official example, please fill the Bones File Field using the browse button y'all can come across that the fully qualified path proper noun is starting with C:\fakepath and not the one really selected.

    and also in the instance description it says
    "The file path reported by the getValue method will"

    I read in docs that the setValue is "browser dependent",

    The goal is to know from which location of the customer the file is uploaded

    Anyway i confirm that upload is working anycase
    Probably if yous are using that informtion for y'all logging... information technology is wrong and I agree it is a problem in some cases


  7. #6

    Default

    Quote Originally Posted by dtex-lab View Post

    As pegaso52it wrote

    in the official example at
    http://docs.sencha.com/extjs/4.ii.1/east...le-upload.html

    the problem exists

    so zip to practise with extension washed.

    from official case, please fill the Basic File Field using the browse button you can meet that the fully qualified path proper name is starting with C:\fakepath and non the one actually selected.

    and also in the example description it says
    "The file path reported by the getValue method will"

    I read in docs that the setValue is "browser dependent",

    The goal is to know from which location of the client the file is uploaded

    Anyway i ostend that upload is working anycase
    Probably if you are using that informtion for yous logging... it is incorrect and I concord it is a trouble in some cases

    I understand the "trouble" as stated, simply it'south not really a problem, at least not from an Ext JS perspective. JavaScript does not, and should not , have access to the customer'southward file system, so I'chiliad not certain why anyone would call back they should be able to get the full path to a file from a client'southward motorcar.

    Moreover, I tin can't empathise why one would need that anyway. You certainly don't need information technology to upload a file, then the but reason would exist a nefarious i (or a misguided i that doesn't empathize how file uploads piece of work).

    I would personally Hate to know that someone was tracking or logging the path to a file on my computer, and would never employ the site if I knew they were able to do that. They can have no possible reason to need to know that, unless of form I am installing a program (non JavaScript, of course) in which I grant access to that kind of data.


  8. #7

    pegaso52it is offline

    Sencha Premium Fellow member


    Default

    Cheers for your assistance, I have solved the problem.


  9. #viii

    mrinal3199 is offline

    Sencha User


    Default fakepath problem

    Hi,

    How you lot slved it?? Tin yu share it with me. I am also getting same error as C:\fakepath\*...xls in chrome.

    Thanks in advance.


  10. #nine

    Default

    Quote Originally Posted by mrinal3199 View Post

    Hi,

    How you slved information technology?? Can yu share it with me. I am as well getting aforementioned error as C:\fakepath\*...xls in chrome.

    Thanks in advance.

    There'south zip to "solve". Review the respond to this thread--information technology gives the information you demand. Also, exist enlightened that this has zero to do with Ext JS, but is rather more than a question of how browser'south work and the access which JavaScript has to the customer machine.


  11. #ten

    mrinal3199 is offline

    Sencha User


    Default

    Hi,
    It's a combination of html and java script file which information technology is calling. You mean to say there is no style to get the correct filepath in chrome in this way? I could understand the security which chrome provides in looking for local drives. But is at that place any alternate way to go the required filepath not just the filename as we are getting in IE after setting changes?

    Cheers once more


curtinbefeepilf.blogspot.com

Source: https://forum.sencha.com/forum/showthread.php?267159-Chrome-shows-always-quot-c-fakepath-quot-in-upload-field-instead-of-the-right-path

0 Response to "How to Get Rid of C:fakepath in Ie When Uploading a File to the Website [fix]"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel