2

我正在尝试将图像文件上传到服务器。我正在应用来自https://github.com/valentinradu/WhiteRaccoon的示例

这是代码:

    UIImage *image = [UIImage imageNamed:@"hotel1.jpg"];
    NSData *imageData = UIImageJPEGRepresentation(image, 0);

    WRRequestUpload * uploadImage = [[WRRequestUpload alloc] init];
    uploadImage.delegate = (id)self;

    //for anonymous login just leave the username and password nil
    uploadImage.hostname = @"***.***.***.***";
    uploadImage.username = @"-------";
    uploadImage.password = @"-------";

    //we set our data
    uploadImage.sentData = imageData;

    //the path needs to be absolute to the FTP root folder.
    //full URL would be ftp://xxx.xxx.xxx.xxx/space.jpg
    uploadImage.path = @"/android_images/image.jpg";

    //we start the request
    [uploadImage start];

但它给出了错误 -[WRRequestListDirectory stream:handleEvent:] [Line 1004] Unknown error!

我错过了什么吗?请帮帮我。

4

2 回答 2

1

在 uploadimage.hostname 属性中尝试跳过 ftp:// 部分并单独输入主机地址,例如:“qwerty.com”而不是“ ftp://qwerty.com ”,它为我解决了,并确保给出的认证细节是正确的。干杯!!

于 2013-05-22T08:05:29.460 回答
0

如果您使用的是 BlackRaccoon,

BRRequest.m请在文件中更改一行。

- (id)initWithDelegate:(id<BRRequestDelegate>)aDelegate功能。改变

self.passiveMode = YES;

self.passiveMode = NO;

它会工作....

这种改变对我有用。

于 2014-08-21T13:28:29.600 回答