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 != '':
似乎沒有任何工作。
任何人都會遇到這種情況?