Post text file to a computer on the same network

James

Well-known member
Joined
Oct 3, 2002
Messages
78
In the past, Ive 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)
.
.
.
Ive 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
 
Heres a better explanation.

Im using asp.net w/Visual Basic.

The uploadedFile is a <input id="uploadedFile" type="file" name="uploadedFile" runat="server">. When I submit the selected file, I want to save it to another users computer instead of a folder on the web server.

James
 
You mean you cant save in path like "\\computerName\test\"?

Just want to check with you regarding the permission and security setting. Did you share your folder to "everyone" and "guests" for permission setting? how about the security setting? did you share also to "everyone" and "guests"?

It should work fine if all your security and permission is correct.
 
All the permision are correct. I even tried directory.Exists("\\computerName\test\") and it returned false. Im starting to believe that I can only save file to the web server only when I use uploadedFile.PostedFile.SaveAs("c:\inetpub\wwwroot\WylePricingSystem\MonthlyArchive\" + myFileName).

Any thoughts?

James
 
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.

James
 
Back
Top