Airikr
Airikr

Reputation: 6436

Save the location of given file

I wonder if it's possible to choose a file and then save the location to the file to the database, for example C:\folder\another-folder\file.txt through HTML or JavaScript?

Thanks in advance.

Upvotes: 0

Views: 81

Answers (3)

krishnakid
krishnakid

Reputation: 108

Not completely sure since I have never actually done something like this in the past -- most likely it is not possible to get the actual location of the file in the native system unless the user inputs it directly, but perhaps you can extract it from a file upload?

http://www.w3schools.com/jsref/dom_obj_fileupload.asp

Upvotes: 1

Viktor S.
Viktor S.

Reputation: 12815

No. You can't do that in browser because of security restrictions. You can get its name (`file.txt'). The only thing you can do - is to give a user an input to select and upload file. After it is on your server - you can do with it whatever you want.

Upvotes: 3

Gung Foo
Gung Foo

Reputation: 13558

Javascript and HTML are both evaluated on the client (browser), so without any server-side scripting this is not possible.

Upvotes: 1

Related Questions