I need some help to upload files to different server. My web application is in server X and I need to create a page that will allow the user to upload files to specific location of server Y. right now I am successful in uploading files to same webserver. I
would appreciate If somebody could help me.
Sub UpdateBtn_Click(sender As Object, e As EventArgs)
' Only Update if Input Data is Valid
If Page.IsValid = True Then
Dim length As Integer = CInt(FileUpload.PostedFile.InputStream.Length)
Dim contentType As String = FileUpload.PostedFile.ContentType
If Upload.Checked = True and Not (FileUpload.PostedFile Is Nothing) Then
' Calculate virtualPath of the newly uploaded file
Dim virtualPath As String = "uploads/" + Path.GetFileName(FileUpload.PostedFile.FileName)
'Dim virtualPath As String = "I:\Inetpub\wwwroot\ensemblepmo\docs\Market Implementation Packet\ETSPORTAL" + Path.GetFileName(FileUpload.PostedFile.FileName)
' Calculate physical path of the newly uploaded file
' Dim phyiscalPath As String = Server.MapPath(virtualPath)
phyiscalPath = Server.MapPath(virtualPath)
' Save file to uploads directory
FileUpload.PostedFile.SaveAs(phyiscalPath)
PathField.Text = virtualPath
End if
.......................
..................
End sub
Have you tried creating the Uploads Virtual Directoy in IIS pointing to a share on the remote computer, and specifying the correct user/password with write permissions to it?
I did try map the folder from server Y but I get the symbol error next to it. When I tried mapping to local folder it works fine. Am I missing something? I am sure I am giving right username and password when I map. I would appreciate If somebody could help
me. Thanks Mals
malathisusee
Member
90 Points
18 Posts
Upload files to different server
Aug 11, 2003 04:01 PM|LINK
Sub UpdateBtn_Click(sender As Object, e As EventArgs) ' Only Update if Input Data is Valid If Page.IsValid = True Then Dim length As Integer = CInt(FileUpload.PostedFile.InputStream.Length) Dim contentType As String = FileUpload.PostedFile.ContentType If Upload.Checked = True and Not (FileUpload.PostedFile Is Nothing) Then ' Calculate virtualPath of the newly uploaded file Dim virtualPath As String = "uploads/" + Path.GetFileName(FileUpload.PostedFile.FileName) 'Dim virtualPath As String = "I:\Inetpub\wwwroot\ensemblepmo\docs\Market Implementation Packet\ETSPORTAL" + Path.GetFileName(FileUpload.PostedFile.FileName) ' Calculate physical path of the newly uploaded file ' Dim phyiscalPath As String = Server.MapPath(virtualPath) phyiscalPath = Server.MapPath(virtualPath) ' Save file to uploads directory FileUpload.PostedFile.SaveAs(phyiscalPath) PathField.Text = virtualPath End if ....................... .................. End subCarlosAg
Participant
1355 Points
271 Posts
Microsoft
Re: Upload files to different server
Aug 11, 2003 08:06 PM|LINK
malathisusee
Member
90 Points
18 Posts
Re: Upload files to different server
Aug 13, 2003 06:59 PM|LINK