I generated the pdf in my iphone app, now i want to send that pdf to server. for that i am converting to NSData and i am sending.
I searched in google and i find solution by using "POST" but it is working for images.
In the server it is uploading but the pdf is not opening it says the attachment has some error
In the following code i did this:
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;
Please guide me,
Thanks in advance.
Instead of this
[request addData:pdfdata forKey:@"file"];
use the below code
[request setFile:self.pdfFilePath forKey:@"file"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With