0

I have created an upload file functionality using <input type="file" name="attachment"/>. I need to know the absolute path of the file attached, for e.g if I browse file from the location D:/MyFolder/Test.text

How can I get this location using VBScript?

Shadow Wizard Says No More War
  • 64,101
  • 26
  • 136
  • 201

1 Answers1

0

According to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. Instead, the string that is returned by the script, which handles the file information is C:\fakepath.

This requirement is already implemented in Internet Explorer 8 – the real path to the file will be shown only if the page that contains the control is added to the trusted sites collection of the browser. That made sense; essentially the browser is feeding that lame C:\fakepath\ text in.

Reference

You can Just get the name of selected file using this:

var fileName = fileInput.value.replace("C:\\fakepath\\", "");
Ali Sheikhpour
  • 9,470
  • 5
  • 35
  • 73