Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filecopy problem

Status
Not open for further replies.

vilrbn

Programmer
Oct 29, 2002
105
FR
Hello,

I got this unusual message on each remote workstation after a FileCopy:

Could not find file "D:\Test.txt"
System.IO.FileNotFoundException: Could not find file "D:\Test.txt"

The problem is occuring on the source file (and not the destination !)... I'm getting it using an HtmlInputFile (Browse button).

<form language=&quot;javascript&quot; id=&quot;Form1&quot; method=&quot;post&quot; encType=&quot;multipart/form-data&quot; runat=&quot;server&quot;>
<input class=&quot;dfont&quot; id=&quot;FileType&quot; type=&quot;file&quot; name=&quot;FileType&quot; runat=&quot;server&quot;>

Code-behind:

Protected WithEvents FileType As System.Web.UI.HtmlControls.HtmlInputFile

Dim imgStream As Stream = FileType.PostedFile.InputStream
Dim imgData(FileType.PostedFile.ContentLength) As Byte
Dim intFileNameLength As Integer
Dim strFileName As String
Dim Filename As File
Dim strFileNamePath As String

imgStream.Read(imgData, 0, FileType.PostedFile.ContentLength)
strFileNamePath = FileType.PostedFile.FileName
intFileNameLength = InStr(1, StrReverse(strFileNamePath), &quot;\&quot;)
strFileName = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)

FileCopy(strFileNamePath, ConfigurationSettings.AppSettings(&quot;ServerPath&quot;) + strFileName)

Web.Config:
<appSettings>
<add key=&quot;ServerPath&quot; value=&quot;\\ServerName\ShareFolderName\AppliFolderName\&quot;/>
</appSettings>

It's working on my localhost.
If I access the URL of the server from my machine, it's not copying the file but I don't get any error.
For other users it's a 'file not found' msg.
I guess it's an access problem. But everyone is admin of its own workstation and they have full control on the server drive.

My source file is like: &quot;D:\text.txt&quot;
My destination path: &quot;\\ServerName\ShareFolderName\AppliFolderName\text.txt&quot;

Do I have to use another function than Filecopy ?

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top