Receiving fake path while uploading

后端 未结 4 1235
温柔的废话
温柔的废话 2020-12-21 16:53

Whenever the uploading process happens through the Browsers rather than IE, the path
belongs to the file from client side systems is showing like \"c:/fakepath/x.jpg\"

相关标签:
4条回答
  • 2020-12-21 17:39

    Change the ClientId of the AsyncFileUpload control from Inherit to AutoId

    0 讨论(0)
  • 2020-12-21 17:41

    This is a browser security restriction. You can't set the value of the file upload control via script, nor can you read the correct path.

    0 讨论(0)
  • 2020-12-21 17:48

    This post shows a way to remove the 'fakepath' display:

    // Change the node's value by removing the fake path

    inputNode.value = fileInput.value.replace("C:\fakepath\", "");

    0 讨论(0)
  • 2020-12-21 17:53

    Modern browsers won't tell you what the actual path of the file is, because it's really none of your business as an application programmer, and is likely to contain private user information (e.g, their username).

    There is no workaround. Learn to live without that information.

    0 讨论(0)
提交回复
热议问题