Skip to content

method file_upload #546

Answered by wang0618
HunterDouble-X asked this question in Q&A
Feb 27, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

According to the doc, file_upload() return list of the following item (when multiple=True):

{
    'filename': file name,
    'content':content of the file (in bytes),
    'mime_type': MIME type of the file,
    'last_modified': Last modified time (timestamp) of the file
}

So in your case, the following code can be used to save uploaded files to server.

for pic in info['picture']:
  with open(pic['filename'], 'wb') as f:
      f.write(pic['content'])

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HunterDouble-X
Comment options

Answer selected by HunterDouble-X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants