sid*_*der 14 python pylons multipart pyramid
目前,我使用以下方法在Pyramid中上传文件(通过HTML表单).
if request.params.get('form.submitted'):
upload_directory = os.getcwd() + '/myapp/static/uploads/'
my_file = request.POST.get('thumbnail')
saved_file = str(upload_directory) + str(my_file.filename)
perm_file = open(saved_file, 'w')
shutil.copyfileobj(my_file.file, perm_file)
my_file.file.close()
perm_file.close()
Run Code Online (Sandbox Code Playgroud)
我只是想知道,这是保存文件上传的好方法,我的方法有任何安全问题吗?我怎么能改进我的方法.谢谢.
归档时间: |
|
查看次数: |
3848 次 |
最近记录: |