Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
8082 Prikazi

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
Opusti
Avtor Best Answer

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
feb. 16
3668
0
maj 20
4053
0
okt. 24
4591
1
apr. 17
4634