title: Python: Uploading files FTP_TLS- "550 The parameter is incorrect"
body: <p>I'm trying to connect to an FTP server using TLS and upload a text file. The below code connects to the site just fine, but it's not uploading the file. Instead I'm getting the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "X:/HR &amp; IT/Ryan/Python Scripts/ftps_connection_test.py", line 16, in &lt;module&gt;
      ftps.storlines("STOR " + filename, open(filename,"r"))
    File "C:\Python33\lib\ftplib.py", line 816, in storlines
      with self.transfercmd(cmd) as conn:
    File "C:\Python33\lib\ftplib.py", line 391, in transfercmd
      return self.ntransfercmd(cmd, rest)[0]
    File "C:\Python33\lib\ftplib.py", line 756, in ntransfercmd
      conn, size = FTP.ntransfercmd(self, cmd, rest)
    File "C:\Python33\lib\ftplib.py", line 357, in ntransfercmd
      resp = self.sendcmd(cmd)
    File "C:\Python33\lib\ftplib.py", line 264, in sendcmd
      return self.getresp()
    File "C:\Python33\lib\ftplib.py", line 238, in getresp
      raise error_perm(resp)
  ftplib.error_perm: 550 The parameter is incorrect. 
  </code></pre>
  
  <p>There's probably something really basic I'm missing, my code is below and any help is much appreciated.</p>
  
  <pre><code>import os
  from ftplib import FTP_TLS as f
  
  # Open secure connection
  ftps = f("ftp.foo.com")
  ftps.login(username,password)  
  ftps.prot_p()                        
  
  # Create the test txt file to upload 
  filename = r"c:\path\to\file"
  testFile = open(filename,"w")
  testFile.write("Test file with test text")
  testFile.close()
  
  # Transfer testFile
  ftps.storlines("STOR " + filename, open(filename,"r"))
  
  # Quit connection
  ftps.quit()
  </code></pre>