Here is my problem. I am using ASIHTTPREQUEST to send request and get response. Now my need of the time is to upload a image,audio , video or docs via PUT method with a custom header . The header takes filename , filesize,sha256sum,username,mediatype,resume as parameters. Here is the code how I am doing that .
-(void)uploadFile
{
NSString *resume =@"0";
NSUserDefaults *userCredentials =[NSUserDefaults standardUserDefaults];
NSString *userName =[userCredentials objectForKey:@"userName"];
NSArray *objects =[NSArray arrayWithObjects:selectedMediaType,delegate.fileName,userName,fileSize,fileSHA256Sum,resume, nil];
NSArray *keys =[NSArray arrayWithObjects:@"mediatype",@"file_name",@"usrname",@"filesize",@"sha256sum",@"resume", nil];
discSentValue =[NSDictionary dictionaryWithObjects:objects forKeys:keys];
NSURL *url = [NSURL URLWithString:@"http://briareos.code20.com/putmedia.php"];
uploadMedia = [ASIFormDataRequest requestWithURL:url];
[uploadMedia addRequestHeader:@"MEDIA_UPLOAD_CUSTOM_HEADER" value:[discSentValue JSONRepresentation]];
[uploadMedia setData:dataToUpload forKey:@"File"];
[uploadMedia setDelegate:self];
[uploadMedia setRequestMethod:@"PUT"];
[uploadMedia startAsynchronous];
}
But the server is unable to recognize the header , it always returns
"invalid header"