html

<form action="" method="post" enctype="multipart/form-data">
    <input type="file" name="f1">
    <button >上传</button>
</form>

Django  view

    file = request.FILES.get('f1')
    file.name # 上传文件的名字
    with open(file.name, 'wb') as f:
        for i in file:
            f.write(i)

 

相关文章:

  • 2021-08-21
  • 2022-01-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-04-27
  • 2021-07-02
  • 2021-11-22
  • 2021-10-12
  • 2021-08-14
相关资源
相似解决方案