AS3 - SimpleFTP客户端将0字节文件上载到Filezilla Server

时间:2015-08-22 20:04:59

标签: actionscript-3 ftp

我正在尝试使用SimpleFTP https://github.com/kohyama/SimpleFTP

上传文件我的filezilla服务器

这是我的代码:

var ftp_client:SimpleFTP = new SimpleFTP("127.0.0.1", "USER", "user1");

var test22:String = "Hello World!";

public function main():void
{
    trace("Attempting to upload a file on: 127.0.0.1 ...");
    connect_test_upload();
}

private function connect_test_upload():void
{
    ftp_client.SimpleFTP.putFile("127.0.0.1", "USER", "user1", "\hello.txt", test22, function(res:String):void{});
    trace("Success!");
}

我就像OMG IT WORKED,但实际上文件是0字节。 (AKA一个derp文件) Filezilla服务器控制台中没有错误。 请帮忙! d:

1 个答案:

答案 0 :(得分:0)

你应该考虑做你所链接的页面建议:

  

要检查您的会话是否成功,请检查是否res.substr(0,3) == "226",否则SimpleFTP.get()调用您的handler res来自FTP服务器的响应res.substr(0,3) == "226"不等于预期。如果public static IEnumerable<CultureInfo> GetAvailableCultures() { List<CultureInfo> result = new List<CultureInfo>(); ResourceManager rm = new ResourceManager(typeof(Resources)); CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures); foreach (CultureInfo culture in cultures) { try { if (culture.Equals(CultureInfo.InvariantCulture)) continue; //do not use "==", won't work ResourceSet rs = rm.GetResourceSet(culture, true, false); if (rs != null) result.Add(culture); } catch (CultureNotFoundException) { //NOP } } return result; } ,内容应保存为您指定的文件。