I'm not entirely sure what was wrong but this is what finally worked for me
import ftplib
import traceback
n="name of upload"
ftp = ftplib.FTP()
ftp.connect("website.com", "21")
print ftp.getwelcome()
try:
try:
ftp.login("user", "password")
ftp.cwd("public_html/test")
f = open("test.JPG", "rb")
name= str(n)+".jpg"
ftp.storbinary('STOR ' + name, f)
f.close()
finally:
ftp.quit()
except:
traceback.print_exc()
Hope this helps anyone else in the same predicament