这个错误是哪的问题啊?在线求解。。。 C# 上传图片到FTP服务器,出现了错误,代码是我复制的,不知道哪个环节出现了错误,求高手指点感激不尽,, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;using System.Net;using System.IO;using System.Globalization;using System.Text.RegularExpressions;//调用UploadFile(txtpath.Text,filename,false); /// <summary> /// 上传文件到FTP服务器 /// </summary> /// <param name="LocalFullPath">本地带有完整路径的文件名</param> /// <param name="RemoteFileName">要在FTP服务器上面保存文件名</param> /// <param name="OverWriteRemoteFile">是否覆盖远程服务器上面同名的文件</param> public bool UploadFile(string LocalFullPath, string RemoteFileName, bool OverWriteRemoteFile) { try { if (!IsValidFileChars(RemoteFileName) || !IsValidFileChars(Path.GetFileName(LocalFullPath)) || !IsValidPathChars(Path.GetDirectoryName(LocalFullPath))) { throw new Exception("非法文件名或目录名!"); } if (File.Exists(LocalFullPath)) { FileStream Stream = new FileStream(LocalFullPath, FileMode.Open, FileAccess.Read); byte[] bt = new byte[Stream.Length]; Stream.Read(bt, 0, (Int32)Stream.Length); //注意,因为Int32的最大限制,最大上传文件只能是大约2G多一点 Stream.Close(); return UploadFile(bt, RemoteFileName, OverWriteRemoteFile); } else { throw new Exception("本地文件不存在!"); } } catch (Exception ep) { ErrorMsg = ep.ToString(); throw ep; } } IsValidFileChars, ErrorMsg 等的定义在哪里? 你复制的肯定不全。IsValidFileChars, ErrorMsg 可能在别的文件里 panel 五秒后切换+切换特效,求解。 怎么给文本框输入的数字,加上双引号。 ImageMap控件的热区问题 关于拖拽的问题,多个文件的打开 outlook工作周 远程调试 c#如何用ODBC连接调用DB2的Stored Procedure? 怎么得到程序的进程的名字? 如何用windows service来与其它的程序共享同一块内存? 1^=1 2^=1+3 3^=1+3+5 编程判断一个数是否是平方数 怎样点击按钮后,才捕获事件,比如键盘按下事件? 调用photoshop com接口读取psd
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Net;
using System.IO;
using System.Globalization;
using System.Text.RegularExpressions;
//调用
UploadFile(txtpath.Text,filename,false);
/// <summary>
/// 上传文件到FTP服务器
/// </summary>
/// <param name="LocalFullPath">本地带有完整路径的文件名</param>
/// <param name="RemoteFileName">要在FTP服务器上面保存文件名</param>
/// <param name="OverWriteRemoteFile">是否覆盖远程服务器上面同名的文件</param>
public bool UploadFile(string LocalFullPath, string RemoteFileName, bool OverWriteRemoteFile)
{
try
{
if (!IsValidFileChars(RemoteFileName) || !IsValidFileChars(Path.GetFileName(LocalFullPath)) || !IsValidPathChars(Path.GetDirectoryName(LocalFullPath)))
{
throw new Exception("非法文件名或目录名!");
}
if (File.Exists(LocalFullPath))
{
FileStream Stream = new FileStream(LocalFullPath, FileMode.Open, FileAccess.Read);
byte[] bt = new byte[Stream.Length];
Stream.Read(bt, 0, (Int32)Stream.Length); //注意,因为Int32的最大限制,最大上传文件只能是大约2G多一点
Stream.Close();
return UploadFile(bt, RemoteFileName, OverWriteRemoteFile);
}
else
{
throw new Exception("本地文件不存在!");
}
}
catch (Exception ep)
{
ErrorMsg = ep.ToString();
throw ep;
}
}
IsValidFileChars, ErrorMsg 可能在别的文件里