2

I want file name, size and type using File API in javascript but without any control means I want to pass hard coded file path. Is any solution?

Thanks in advance.

0

1 Answer 1

4

So you want to pass hard coded file path using javascript.

Thank goodness, in javascript (run inside the browser) you can't do that.
Only the user can populate a <input type="file"> element or File objects in a FileList.

On setting, if the new value is the empty string, it must empty the list of selected files; otherwise, it must throw an InvalidStateError exception.

and

The HTMLInputElement interface [HTML] has a readonly attribute of type FileList...

See a thorough write-up including HTML5 features here: Remember and Repopulate File Input

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks to all. I am getting the file name, size and type through html5 but I was looking for whether it is possible or not by hard coded path. So thank you for your reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.