NSURL *url = [NSURL URLWithString:@
"http://localhost/uploads/xxx.png"
];
NSMutableURLRequest *requestM = [NSMutableURLRequest requestWithURL:url cachePolicy:0 timeoutInterval:2.0f];
requestM.HTTPMethod = @
"PUT"
;
NSString *authStr = @
"admin:123456"
;
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64Str = [authData base64EncodedStringWithOptions:0];
NSString *auth = [NSString stringWithFormat:@
"BASIC %@"
, base64Str];
[requestM setValue:auth forHTTPHeaderField:@
"Authorization"
];