<分区>
我在我的 iphone 应用程序中生成了 pdf,现在我想将该 pdf 发送到服务器。为此,我正在转换为 NSData 并正在发送。
我在谷歌中搜索并通过使用“POST”找到了解决方案,但它适用于图像。
在服务器上它正在上传但 pdf 打不开它说附件有一些错误
在下面的代码中我这样做了:
NSData *pdfdata = [[NSData alloc] initWithData:[self.pdfFilePath dataUsingEncoding:NSASCIIStringEncoding]];
ASIFormDataRequest *request=[ASIFormDataRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MainUrl,@"updatefile.php"]]];
[request setDelegate:self];
[request setPostValue:appDelegate.userId forKey:@"userid"];
[request addData:pdfdata forKey:@"file"];
[request startSynchronous];
//self.pdfFilePath =/var/folders/a0/a01nF1oGGkebQxw7H0YsBU+++TI/-Tmp-/MyAccount.pdf;
请指导我,
提前致谢。