Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Asp.net- How to Get Full File Path from Fileupload Control in Firefox or IE

Dec 16, 2012
Introduction:

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.

Description:


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


string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);
fileUpload1.SaveAs(Server.MapPath("Files/"+filename));
string filepath = "Files/"+filename;
If you want see it in complete example check below post


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

10 comments :

Unknown said...

You are doing a great job boss, pls kp it up.

javeed said...

hi...........

i am using file upload control inside the update panel. in my page there are max of 5-6 buttons are present when we click on any button the page postbacks and the path is getting cleared from the fileuploader. is there any way to hold value inside the file uploader.

Please give me the solution for this as soon as possible...

ashu said...

how i retrieve video which was uploaded by fileupload control

Unknown said...

string path = @"D:\emp.xlsx";

Unknown said...

Wrong total wrong, i think you dont know about the security of browsers or iis, you never ever access the full path of the client file in server it will always return (fakepath) because the security policy (ya it is working if client and server exist in same server i.e local server)

Unknown said...

Hi,
I want the full path using jquery. How would i get it?

Unknown said...

sir can You please show us, how to upload and download file in asp.net thought FTP

Bhavesh Bhuva said...

Very Good Example
Thank You.......

Anonymous said...

@deepti thakur - Here it will store file on server and not in the client pc. So it will access the file path.

Unknown said...

can i get file full path using javascript ?

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.