C# – Getting the full file path when using a file upload control

asp.netcfile upload

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 wish I could just do a straight shot to amazon…

Best Answer

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

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