I am trying to upload jpg file from my Mac to a PHP website. I am using 3rd party library (ASIHTTPRequest) to upload a file. Here is the code.
I get the following output and pic doesn't upload.
2012-08-14 09:03:47.551 screenCapture[300:a0f] <html><head><title>Apache Tomcat/7.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.26</h3></body></html>
2012-08-14 09:03:47.555 screenCapture[300:a0f] 400
Code:
-(void) upload
{
NSURL *url = [NSURL URLWithString:
@"http://dashboard3.mobistealth.com:8080/bbUploadFile.php?
type=rest&u=mobistealth-
[email]rest@mobistealth.com[/email]&p=9QhDuIZ65TWc&name=saqib"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc]
initWithURL:url] autorelease];
[request setPostValue:@"fileName" forKey:@"318833423305784.jpg"];
[request setFile:@"/Users/User/Documents/318833423305784.jpg"
forKey:@"photo"];
[request startSynchronous];
NSError *error = [request error];
if(!error)
{
NSString *response = [request responseString];
NSLog(@"%@", response);
}
int statusCode = [request responseStatusCode];
NSLog(@"%i", statusCode);
}
I get the following output and pic doesn't upload.
2012-08-14 09:03:47.551 screenCapture[300:a0f] <html><head><title>Apache Tomcat/7.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.26</h3></body></html>
2012-08-14 09:03:47.555 screenCapture[300:a0f] 400
Last edited by a moderator: