PDA

Click to See Complete Forum and Search --> : How to save a text file to another computer on the same network


jl39775
May 15th, 2003, 03:33 PM
In the past, I've saved files to directories that reside on the same machine as the web server. What I want to do today is save files on someone elses machine. I used the following code to save to a directory on the same machine as the web server.

.
.
.
uploadedFile.PostedFile.SaveAs("c:\inetpub\wwwroot\WylePricingSystem\MonthlyArchive\" + myFileName)
.
.
.
I've tried this, to save to a folder on another computer. This folder has all the correct permissions.

.
.
.
uploadedFile.PostedFile.SaveAs("\\computerName\test\" + myFileName)
.
.
.
Does anyone know if and how I can save files to another computer on the network.

Thanks,

James

jl39775
May 27th, 2003, 01:41 PM
I figured out how to save a file to another computer.

add the following to the web.config file"
<system.web>
<identity impersonate="true" userName="mydomain\myusername"
password="mypassword" />
</system.web>

code:
Select a file to upload:<input id="uploadedFile" type="file" name="uploadedFile" runat="server">


Imports System.IO

Dim strFileName As String
strFileName = uploadedFile.PostedFile.FileName
Dim myFileName As String = System.IO.Path.GetFileName(strFileName)

uploadedFile.PostedFile.SaveAs("\\computerName\dir\" + myFileName)

Hope this helps someone.