I am trying to upload an image to a targeted folder.
(i.e. C:\Inetpub\wwwroot\Store\images\)
But my file upload page is in another folder.
(i.e. C:\Inetpub\wwwroot\Store\admin\)
I use the following code:
The thing is that using
System.IO.Path.GetDirectoryName(Server.MapPath("uploadFile.aspx"))
I am uploading it to
"C:\Inetpub\wwwroot\Store\admin\"
Any one have any idea to load it into my desired folder??
Thanks
(i.e. C:\Inetpub\wwwroot\Store\images\)
But my file upload page is in another folder.
(i.e. C:\Inetpub\wwwroot\Store\admin\)
I use the following code:
Code:
Dim strFilePath As String
strFilePath = System.IO.Path.GetDirectoryName(Server.MapPath("uploadFile.aspx"))
uploadFilePath.PostedFile.SaveAs((strFilePath & "\" & "images" & "\" & txtFileName.Value))
lblTitle.InnerHtml = "File uploaded successfully"
lblMessage.InnerHtml = "Your file was uploaded successfully to <br>" & _
"<b>" & strFilePath & "\" & _
txtFileName.Value & "</b><br>on the Web server."
HideFileUploadControls()
HideUserAuthenticationControls()
lblMessage.Visible = True
btnReUpload.Visible = True
HyperLink1.NavigateUrl = "http://localhost/store/images/" & txtFileName.Value
HyperLink1.Visible = True
System.IO.Path.GetDirectoryName(Server.MapPath("uploadFile.aspx"))
I am uploading it to
"C:\Inetpub\wwwroot\Store\admin\"
Any one have any idea to load it into my desired folder??
Thanks
Last edited by a moderator: