0
我不知道这如何检查用于通过POST传递self.request.get( “profile_pic”)从空目标C
这是通从目标C空在Objective-C:
NSData *profile_pic_data = nil; (this does not change)
...
//Profile Pic Data
[body appendData:[[NSString stringWithFormat:@"--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"Content-Disposition: form-data; name=\"profile_pic\"; filename=\"profile_pic.jpg\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[NSData dataWithData:profile_pic_data]];
...
NSLog(@"profile_pic_data = %@", profile_pic_data); //RETURNS (null)
在Python:
...
user_profile_pic_data = self.request.get("profile_pic")
...
if user_profile_pic_data:
#IT RUNS THIS CODE
else:
#IT SHOULD RUN THIS CODE
如果我打印出user_profile_pic_data它是由self.request.get( “profile_pic”)设定之后,在没有显示任何东西。
我曾尝试:
if user_profile_pic_data:
if user_profile_pic_data is not NONE:
if user_profile_pic_data is not NONE and != '':
似乎没有任何工作。
任何人都会遇到这种情况?