javascript - Getting full file path of a clients file using a file dialog box - Stack Overflow

I am trying to allow users to upload pictures to the server.I am trying to create a similar system to a

I am trying to allow users to upload pictures to the server.

I am trying to create a similar system to any website that has an 'attach' file or 'upload image' feature. All I need is to get the full path of the file select by the file dialog.

I tried using this for the file dialog with no success:

<input type="file">

This method does not provide the full file path, due to security reasons. My question is how can I create a similar input dialog to websites like tinypic, photobucket, etc.. that can help users input the full file path of a given image, into an input field?

I am aware that this cannot be done using the method above for security reasons, however, I have seen this done before on various websites without any problems, I was wondering what I had to do to implement a similar file dialog that helps fill in the text, which is a full file path, of an input field?

I am trying to allow users to upload pictures to the server.

I am trying to create a similar system to any website that has an 'attach' file or 'upload image' feature. All I need is to get the full path of the file select by the file dialog.

I tried using this for the file dialog with no success:

<input type="file">

This method does not provide the full file path, due to security reasons. My question is how can I create a similar input dialog to websites like tinypic, photobucket, etc.. that can help users input the full file path of a given image, into an input field?

I am aware that this cannot be done using the method above for security reasons, however, I have seen this done before on various websites without any problems, I was wondering what I had to do to implement a similar file dialog that helps fill in the text, which is a full file path, of an input field?

Share Improve this question asked Dec 20, 2012 at 16:21 AnchovyLegendAnchovyLegend 12.6k41 gold badges153 silver badges240 bronze badges 10
  • Are you trying to read the files locally? – closure Commented Dec 20, 2012 at 16:25
  • Why would you ever need the full path? – ThiefMaster Commented Dec 20, 2012 at 16:26
  • I suspect it's possible with Flash but not with a pure JavaScript solution. – Pointy Commented Dec 20, 2012 at 16:26
  • No it is not possible to get the full path of the file. Why do you need it anyway? I hope you are aware that file can be read the file even without having full path.... – closure Commented Dec 20, 2012 at 16:31
  • I need the full file path for the same reasons that websites like photobucket and tinypic need the full file path... I need server-side access to the clients file. @closure, There is no question whether or not it is possible, it IS possible (see photobucket, tinypic, etc.. for proof), I am just not sure how to implement it. – AnchovyLegend Commented Dec 20, 2012 at 16:48
 |  Show 5 more ments

1 Answer 1

Reset to default 3

It is not possible to get the file full path on local machine using browser and javascript.

However, as you would like to upload the file to the server, the easy possibility I see is to use html form with input type file. You will receive the file on your http server when the form is submitted.

Here is a very good url http://www.cs.tut.fi/~jkorpela/forms/file.html that explains the whole process nicely.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744835358a4596230.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信