我正在尝试将图像文件上传到服务器。我正在应用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]未知错误!
我错过了什么。请帮帮我。答案 0 :(得分:1)
在uploadimage.hostname属性中尝试跳过ftp://部分并单独输入主机地址,例如:“qwerty.com”而不是“ftp://qwerty.com”,它为我解决了,并确保给出的验证详细信息是正确的。欢呼!!
答案 1 :(得分:0)
如果您使用的是BlackRaccoon,
请在BRRequest.m
文件中进行一行更改。
在- (id)initWithDelegate:(id<BRRequestDelegate>)aDelegate
功能中。
改变
self.passiveMode = YES;
到
self.passiveMode = NO;
它会起作用....
这种改变对我有用。