ftp上传路径错误 文件获得的是服务器的路径
我用ftp上传一些文件,在本机上测试没有问题..但是在另一台机子上连接我机子的网页测试出现问题.
我前台用的是
<INPUT TYPE="file" ID="UP_FILE" RUNAT="server" NAME="UP_FILE">
<asp:Button ID="btnFtpUpload" runat="server" Text="开始上传" onclick="btnFtpUpload_Click" />
后台:
文件获取是:
System.Web.HttpPostedFile postedfile = UP_FILE.PostedFile;
FileName = postedfile.FileName;
//这个也不行 postedfile.FileName.Substring(postedfile.FileName.LastIndexOf("\\") + 1)
后台有一个上传类,调用里面的上传方法:
ftpUpfile.Upload(FileName);
但是就会报这个错误:
System.IO.DirectoryNotFoundException: 未能找到路径“F:\xxxx\xxxx\xxxx\xxxx\xxxx\xx.gif”的一部分。 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) 在 System.IO.FileStream..ctor(String path, FileMode mode)
好像这个获取的是服务器的文件,也就是我机子上的,因为没有才报错.
要怎么样才能获取客户端的文件呢,希望大家帮帮忙.. --------------------编程问答-------------------- 帮顶 --------------------编程问答-------------------- System.Web.HttpPostedFile postedfile = UP_FILE.PostedFile;
这样就已经获取了呀,
只要调用postedfile.SaveAs(filename);就可以保存到服务器上
补充:.NET技术 , ASP.NET