Skip to content

How to save upload files to directory #26

Answered by wang0618
ZHANGGONGQUAN asked this question in Q&A
Discussion options

You must be logged in to vote

要将上传的文件写到本地,可以直接以二进制写模式打开一个文件,把上传的文件的内容写进去即可:

f = file_upload(accept='.txt')
open('upload.txt', 'wb').write(f['content'])

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@ZHANGGONGQUAN
Comment options

Answer selected by ZHANGGONGQUAN
Comment options

You must be logged in to vote
2 replies
@wang0618
Comment options

@ZHANGGONGQUAN
Comment options

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