string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);
string filepath = "Files/"+filename;
By: Suresh Dasari Dec 16, 2012
Here I will explain how to get full path of uploaded file from fileupload control from client machine in Firefox or IE in asp.net using C#, VB.NET.
In previous posts I explained Ajax AsyncFileUpload control example in asp.net, upload and download files from folder in asp.net, asp.net, C#, SQL Server Interview Questions, jQuery validate file extension in file upload control and many articles relating to asp.net, C#, VB.NET code snippets. Now I will explain how to get full path from fileupload control in asp.net using C#, VB.NET.
In many forums I saw the question like How to get full path from fileupload control from client machine?
For this question answer is we don’t have chance to get full path of uploaded file from fileupload control because of some security reasons browsers will return only file name instead of full file path from client machine.
If you want to get full path of uploaded file from fileupload control from client machine we need to save that file in our application folder from that we can get path of that file like as shown below
If you want see it in complete example check below post
Other Related Posts
- Interview Questions in ASP.NET,C#.NET,SQL Server,.NET Framework
- 3 tier architecture example in asp.net with C#
- Asp.net insert, Edit, update, delete data in gridview
- Introduction to Object Oriented Programming Concepts (OOPS) in C#.net
- Simple login form example in asp.net Check Username and Password availability in database
- Introduction to WCF - WCF tutorial | WCF Tutorial - Windows Communication Foundation | WCF Example | WCF Sample code in asp.net 3.5 | Basic WCF Tutorial for Beginners
- how to insert images into database and how to retrieve and bind images to gridview using asp.net (or) save and retrieve images from database using asp.net
- jQuery 360 Degrees Image Display Plugins Examples with Tutorial
- Asp.net WebService or Creating and Consuming WebService in asp.net or Create and call webservice in asp.net or how to create webservice and how to use webservice in asp.net
- Ajax ModalPopUpExtender Example to edit the gridview row values in asp.net