Skip to Content
मेन्यू
This question has been flagged
1 Reply
8398 Views

Hi, Everyone,

I used the code:

with open('z.jpg','wb') as f:
f.write(base64.b64decode(self.file))

the 'file' is the name of Binary field which have put a photo in, but I can't open the file (z.jpg) I have got correctly.

So, Are there anyone can modify this code and make it work?

Avatar
Discard
Author Best Answer

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Avatar
Discard
Related Posts Replies Views Activity
0
फ़र॰ 16
4072
0
मई 20
4563
0
अक्तू॰ 24
5175
1
अप्रैल 17
5159