C# .NET - How to retrive the path for saved file in the folder in fileupload control?

Asked By Sai M on 08-Apr-13 01:01 AM
DataTable dt = new DataTable();
     dt = DemBiz.CRM.CrmCommon.SelectDocument(id);
     txtDocname.Text = dt.Rows[0]["Document_Name"].ToString();
     cmbCategory.SelectedValue = dt.Rows[0]["Category"].ToString();
     cmbSubcategory.SelectedValue = dt.Rows[0]["SubCategory"].ToString();
      
      
     string filename = dt.Rows[0]["Filename"].ToString();
     string path = (Server.MapPath("~/CRMS/Documents/" + filename));
     System.IO.FileInfo file = new System.IO.FileInfo(path);
     liShowdoc.Text = filename;
      
     txtRevision.Text = dt.Rows[0]["Revision"].ToString();
     cmbStatus.SelectedValue = dt.Rows[0]["Document_Status"].ToString();
     txtPublishdate.Text = Convert.ToDateTime(dt.Rows[0]["Publish_Date"].ToString()).ToShortDateString();
     if (!Convert.IsDBNull(dt.Rows[0]["Expiration_Date"]))
     txtExpdate.Text = Convert.IsDBNull(dt.Rows[0]["Expiration_Date"]) ? null : Convert.ToDateTime(dt.Rows[0]["Expiration_Date"].ToString()).ToShortDateString();
     txtDescription.Text = dt.Rows[0]["Description"].ToString();



Actual The problem is when iam saving the document is being saved in the folder.so if i want the same document to be edited iam not geting the path following is my code to retrive the data
Danasegarane Arunachalam replied to Sai M on 13-Apr-13 07:50 AM
If you want to get the path of the client then it is not possible. Due to security reason this is restricted. And if you are trying to get the server path, you will save the upload file as

string FilePath=Server.Mappath("/Uploads/" + Fileupload1.Filename);
FileUpload1.Saveas(FilePath)

Where FilePath will contain the server file path
Sai M replied to Danasegarane Arunachalam on 15-Apr-13 12:25 AM
ok can i use Ajax fileupload..Actually i want multiple fileupload which accepts all type file with 2mb as limit for each upload
where the client can upload the files...So which will be the best method..can u suggest me..Iam using web application using c# and jquery at present in my application
Sai M replied to Danasegarane Arunachalam on 15-Apr-13 12:25 AM
end of post
Danasegarane Arunachalam replied to Sai M on 16-Apr-13 11:30 AM
Here is jquery wiki for multi file upload : docs.jquery.com/Tutorials:Multiple_File_Upload_Magic
Danasegarane Arunachalam replied to Sai M on 16-Apr-13 11:37 AM
Try this one . Looks awesome

http://webdeveloperplus.com/jquery/multiple-file-upload-with-progress-bar-using-jquery/