get virtual path from physical path

Posted by Oswaldlily under ASP.NET on 5/8/2013 | Points: 10 | Views : 2408 | Status : [Member] | Replies : 1
Here openfile.Filename gives physical path which i couldnt access from other system other than my localsystem

I need virtual path so that i can access from anywhere

System.Windows.Forms.OpenFileDialog openfile = new System.Windows.Forms.OpenFileDialog();
string pathname = Path.GetFileName(openfile.FileName);
byte[] byteArray =System.Text.Encoding.UTF8.GetBytes(openfile.FileName);


Posted by: Learningtorise on: 5/10/2013 [Member] Starter | Points: 25

Acc. to me you can do this:

Add a folder, example 'Uploads' in your application.

Save FileName in a String Variable.
Save file from OpenFile Dialog in this folder using Dialog.SaveAs(Server.MapPth (Folder Path)), temporary.

Then access this file using fileName from 'Uploads'.
Delete this file from 'Uploads' when done.

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response