I have been working on creating a simple ftplib upload script that can send a file to a server. Everything works fine but now I want to know if its possible to use a html form to allow a user to chose the file to be uploaded. This would mean defining the file from the form in the script. I am unsure of how to go about this?
Here is my ftp upload script:
import ftplib filename = 'test.doc' ftp = ftplib.FTP('ftp.*******.com') ftp = ftp.login('****','*****') ftp.cwd('uploads') myfile = open('/Users/Joey/Downloads/test.doc', 'rb') ftp.storbinary('STOR ' + filename, myfile) ftp.quit
I have been using the Python shell to execute this script, will I need to make changes if I wanted this script to be executed when the user submits the form?
I am using wamp as a local server to host my simple html form on a webpage. I am assuming you need a variable to record the file chosen from the form, instead of my script just having the test file already written?
Thanks for any help in advance