Skip to Content
Menu
This question has been flagged
1 Atsakyti
8391 Rodiniai

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?

Portretas
Atmesti
Autorius Best Answer

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
vas. 16
4071
0
geg. 20
4563
0
spal. 24
5172
1
bal. 17
5157