django简单上传功能
获取此错误:
Exception Type: AttributeError
Exception Value: 'InMemoryUploadedFile' object has no attribute 'save'
尝试使Django函数如此简单时:
def upload(request):
file = request.FILES["picture"]
file.save("hello.png")
return HttpResponse("done uploading")
注意:我知道有更长的方法来制作此简单过程,但我现在需要它像这个一样简单
Getting this error:
Exception Type: AttributeError
Exception Value: 'InMemoryUploadedFile' object has no attribute 'save'
When trying to have a Django function as simple as:
def upload(request):
file = request.FILES["picture"]
file.save("hello.png")
return HttpResponse("done uploading")
Note: I know there is a longer way to make this simple procedure but I need it for now to be as simple as this one
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在块中读取上传的文件,然后写入所需的文件,有关详细信息,请参见文档
You can read the uploaded file in chunks and write to your desired file, see the documentation for details