开发者

Getting the full file path when using a file upload control

I wrote some code to upload files to amazon S3, if I put a full file path manually It successfully uploads the file from my computer. What I'm trying to do is use a file upload control and store the full path in a variable so that I can use it for my amazon method. Ive read everywhere it seems that the browser won't let you get the full file path for security reasons.

How can I get the full file path? Should I just store the files on my webserver and point my amazon method to the server path, and then use the file upload control to tell it what the filename is? I w开发者_开发问答ish I could just do a straight shot to amazon...


First we have to save the file path and then we take it from

string filepath=Path.GetFullPath(UploadFile1.FileName.toString());


I came across this link which has a great tutorial and even gives you a working sample project. (this is different from the code that the .net SDK includes...) http://aws.amazon.com/articles/774?_encoding=UTF8&jiveRedirect=1


We can't take full path in HTML or JS as it violets security so whenever you try to see the path it shows fakepath

so to resolve this issue you can make a seprate folder and you can store the uploaded file there and in the code you can take that folders path as default and use it as a absolute path.

You can get the full path using Python Tkinter but it is limited for desktop app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜