Python 3 script to upload files to server

  • Post author:
  • Post category:Python

Hello, I leave you a small script that will serve you as I said in the title script to upload files to a server using python in a single command line

import os

fileitem = form['filename']
# file has been uploaded successful

if fileitem.filename:

    fn = os.path.basename(fileitem.filename)


   #check the file in the server

    open(fn, 'wb').write(