0

I need to have a string like this,

Content-Disposition = name="uploaded file" in my HTTP request header.

I tried using escape sequences \" like this (as mentioned here)

NSString *valueString = @"name=\"uploadedfile\" ";

it returns me an output like this : "Content-Disposition" = "name=\"uploadedfile\"";

how can i do this? Please help. Thanks.

Community
  • 1
  • 1
Vineet
  • 161
  • 1
  • 8
  • 1
    Just NSLog the valueString and check what is the output, if it is correct, then the issue will be with some other part – Midhun MP May 23 '14 at 08:16
  • Isn't your header formed wrong btw? Shouldn't it be: Content-Disposition: name="YOUR NAME"? – Widerberg May 23 '14 at 08:17
  • ` NSString *name = @"name=\"uploadedfile\""; NSLog(@"%@",name);` //Result = name="uploadedfile" – nmh May 23 '14 at 08:20
  • @MidhunMP I get this after NSLogging. "Content-Disposition" = "name=\"uploadedfile\""; – Vineet May 23 '14 at 09:43
  • @AlexanderW This is how the request header is being formed Request Header: { "Accept-Language" = "en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5"; "Content-Disposition" = "name=\"uploadedfile\""; "Content-Type" = "application/json; charset=utf-8"; "User-Agent" = "Collectors/1.0 (iPad; iOS 7.1.1; Scale/2.00)"; } – Vineet May 23 '14 at 09:47
  • @nmh If you notice closely, I'm doing the same thing as you have mentioned in your answer and the problem is the \" are also getting printed. Please see the above comment to check how it is being printed. – Vineet May 23 '14 at 09:51
  • Show your full code which return wrong value? – nmh May 23 '14 at 09:54
  • @nmh This is how I'm setting it. NSString *valueString = @"name=\"uploadedfile\""; [request setValue:valueString forHTTPHeaderField:@"Content-Disposition"]; – Vineet May 23 '14 at 10:36

0 Answers0