I want to make a request in maultipartform, in this format --
<form action="http://xyz.com/web/video/formupload/01f7e4d2-9484-44ed-9e5d-bb4b7ff67739" method="post"
enctype="multipart/form-data" ">
<input id="uploadedFile" type="file" name="uploadedFile"/>
<input type="hidden" name="token" value="TOKEN"/>
<input type="submit" value="go" />
</form>
I am using asiformdatarequest class for this purpose .. This is my code below
ASIFormDataRequest *videoUploadRequest = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:[tokenValue objectForKey:@"url"]]];
[videoUploadRequest setPostFormat:ASIMultipartFormDataPostFormat];
[videoUploadRequest addData:[tokenValue objectForKey:@"token"] forKey:@"token"];
[videoUploadRequest addData:video withFileName:@"New Video" andContentType:(@"video/*") forKey:@"uploadedFile"];
[videoUploadRequest startSynchronous];
NSError *error = [videoUploadRequest error];
if (!error)
{
NSString *response = [videoUploadRequest responseString];
NSLog(@"upload response: %@", response);
}
else
{
NSLog(@"Eror -- %@", error);
}
I am getting an error saying
Eror -- Error Domain=ASIHTTPRequestErrorDomain Code=3 "Authentication needed" UserInfo=0x1e5ee090 {NSLocalizedDescription=Authentication needed}
Please could anyone tell if there is something wrong with the code.. Format of the request or anything else..
Thanks in advance !