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="javascript" id="Form1" method="post" encType="multipart/form-data" runat="server">
<input class="dfont" id="FileType" type="file" name="FileType" runat="server">
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), "\"
strFileName = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
FileCopy(strFileNamePath, ConfigurationSettings.AppSettings("ServerPath" + strFileName)
Web.Config:
<appSettings>
<add key="ServerPath" value="\\ServerName\ShareFolderName\AppliFolderName\"/>
</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: "D:\text.txt"
My destination path: "\\ServerName\ShareFolderName\AppliFolderName\text.txt"
Do I have to use another function than Filecopy ?
Thanks for your help.
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="javascript" id="Form1" method="post" encType="multipart/form-data" runat="server">
<input class="dfont" id="FileType" type="file" name="FileType" runat="server">
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), "\"
strFileName = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
FileCopy(strFileNamePath, ConfigurationSettings.AppSettings("ServerPath" + strFileName)
Web.Config:
<appSettings>
<add key="ServerPath" value="\\ServerName\ShareFolderName\AppliFolderName\"/>
</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: "D:\text.txt"
My destination path: "\\ServerName\ShareFolderName\AppliFolderName\text.txt"
Do I have to use another function than Filecopy ?
Thanks for your help.