How to save upload files to directory #26
Answered
by
wang0618
ZHANGGONGQUAN
asked this question in
Q&A
-
你好, file_upload 可以返回 filename , size ,mite_type, last_modified ,data 请问可以将上传的文件作为一个 object对象 ,用类似 save 的方法将这个上传的文件保存到指定的位置吗? |
Beta Was this translation helpful? Give feedback.
Answered by
wang0618
Feb 19, 2021
Replies: 2 comments 3 replies
-
要将上传的文件写到本地,可以直接以二进制写模式打开一个文件,把上传的文件的内容写进去即可: f = file_upload(accept='.txt')
open('upload.txt', 'wb').write(f['content']) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ZHANGGONGQUAN
-
还是关于这个上传模块的。 介绍中 file_upload 的 max_size =0 ,默认就是不限制大小。 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
要将上传的文件写到本地,可以直接以二进制写模式打开一个文件,把上传的文件的内容写进去即可: