0

How can i get the absolute path of an uploaded file (that has been uploaded by input file) and use it as a <video>.

cvcvka5
  • 57
  • 1
  • 7

1 Answers1

1

For security reasons, you cannot get the absolute path of a file picked from a file picker in front-end JavaScript. That would allow websites to potentially see private information, such as the user's name and their operating system. Also, a user might not want the website to see their folder structure and the names of their folders.

Here is a way of using a file picked for a <video> tag (You don't need to know the full path of file). I didn't make this, but it will probably help you: http://jsfiddle.net/dsbonev/cCCZ2/

How it works is you create a object url.

var fileURL = URL.createObjectURL(fileFromFilePicker);

Then you can set the src attribute of the <video> tag.

If you don't want to actually upload the file, then your question has already been asked and answered here.

programmerRaj
  • 1,810
  • 2
  • 9
  • 19