Click here to Skip to main content
15,909,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,

can anyone teach me how to add the filename to server.mapPath so that it will show path like:
D:\DB\DatabaseA\Upload\Cmpt\FileName

example: D:\DB\DatabaseA\Upload\Cmpt\BankStatement

here is my current code:

VB
Dim path As String = Server.MapPath("Upload/Cmpt/")
Dim tFileName As String = e.UploadedFile.FileName
Posted
Comments
[no name] 16-Aug-13 5:43am    
Use & in VB to concatenate strings or in this case use the Path class.

1 solution

C#
string cont_name = "";
            cont_name = fileuploadcontrol1.FileName;
            string path = Server.MapPath("uploads/");
            fileuploadcontrol1.SaveAs(path + cont_name);
            string FullPath = "uploads/" + cont_name;
 
Share this answer
 
Comments
Mare7 27-Aug-13 23:39pm    
Hi, I change the code a little and it works. Thank You very much.

heres my code:

Dim FilePath As String = path + tFileName

and i added it in the insert statement in my query n i got the filepath and the file name.

Thx again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900