Now I get the file name from the post request like this:

#!/usr/bin/env python3 # (hash)print("Content-type: text/html") import cgi print() form = cgi.FieldStorage() print(form.getvalue('file')) 

By the link I download this:

 url = "https://team.umonreal.ru/file/article/hype/2018/10/18/dbf7558babb75989321eaf9601ffd97d.jpg" img = urllib.request.urlopen(url).read() out = open("img.jpg", "wb") out.write(img) 

I do not understand how to accept a file from the post request and download it.

  • I do not quite understand your question. It seems that there is already a code for downloading the file. - mymedia
  • I need to download the file sent by POST request - 設 計

0