NSString *documentsPath =[self dirDoc];
NSString *goufirefilePath = [documentsPath stringByAppendingPathComponent:filePath];
QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:@"audio/*;application/*" progressHandler:nil params:nil checkCrc:NO cancellationSignal:nil];
QNUploadManager *upManager = [[QNUploadManager alloc] init];
[upManager putFile:goufirefilePath key:key token:token
complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
callback(@[[NSNull null], [NSNumber numberWithInt:info.statusCode]]);
} option:opt];
我通过ios SDK的putFile方法上传caf文件, 当文件很小时,可以上传成功,当caf文件大时,api会自动分片上传,但最后在合并成一个文件的时候报错了。
报错信息如下,提示是mimeType类型不匹配,但文件小的时候又可以上传成功...不知道怎么回事...求助...
2015-08-10 16:52:22.730 gouhuo-native[44806:367944] http://14.152.73.194:80/bput/oT1RlTabWslBXmIan1mzNgHIQZjYzw35E9Thst_nIzd95mmyf26uSmtk01A_VwBXAE8ATwBiAGIAFgAWAF3_Xf_a_tr-0v7S_gf_B_82_zb_-f75_gD_AP8Q_xD_Of85_0X_Rf_z_vP-t_63_gAAAAAAAAgAAAAAAMC2CAAAAAgAekNJQUFKMXN4MVZQRzBZQQ==/524288
2015-08-10 16:52:22.927 gouhuo-native[44806:368315] http://14.152.73.194:80/mkfile/571072/mimeType/YXVkaW8veC1jYWY7YXBwbGljYXRpb24vKg==/key/MzE1ODcwODUxNTk4MDIyMzIyNw==
2015-08-10 16:52:23.051 gouhuo-native[44806:366235] <QNResponseInfo= id: 1439196609886116, status: 400, requestId: ZRcAABEj8APQDfkT, xlog: UP/400, xvia: (null), host: upload.qiniu.com ip: 14.152.73.194 duration: 0.124717 s time: 1439196743 error: Error Domain=qiniu.com Code=400 "The operation couldn’t be completed. (qiniu.com error 400.)" UserInfo=0x7fb1b449fec0 {error=invalid encoded mimeType YXVkaW8veC1jYWY7YXBwbGljYXRpb24vKg==}>
代码中:initWithMime:@"audio/;application/"
这个,是需要一个需要确定的mimetype类型,就是文件上传后,最后在七牛指定的mimetype
一般caf文件的mimetype是这个吧:
audio/x-caf