<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to upload a file in a secured FTP (FTPS)? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461879#M36146</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The point Luke is making is that is a computing skill and not a GIS skill per se, perhaps it is presumed erroneously that one has the former before one applies them to the latter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Dec 2015 14:20:52 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-12-02T14:20:52Z</dc:date>
    <item>
      <title>How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461875#M36142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, all. To upload a file in an FTLS I used the FTP_TLS from ftplib, here is my code (I adapted from a code found on the web):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import ftplib from ftplib
import FTP_TLS
import os 
import ssl 
import sys 
server = XXXXXXXXXXXXX
user = XXXXXXXXXXXXXXXX 
passwd = XXXXX
PathFile = 'Q:\GW\EC1140WH_Con_HF\HCM_CARTS' 
def connect_ftp():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp = FTP_TLS(server, user, passwd)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.set_pasv(True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.prot_p()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.set_debuglevel(2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ftp 
def upload_file(ftp_connection, upload_file_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upload_file1 = open(os.path.join(PathFile,upload_file_path), 'r')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Uploading ' + upload_file_path + "...")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.storbinary('STOR ' + upload_file_path, upload_file1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.quit()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upload_file.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Upload finished.')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception, e:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Error uploading file: " + str(e))
ftp_conn = connect_ftp()
if ftp_conn:&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Success connection")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upload_file(ftp_conn, 'LisezmoiReadme.docx')
&lt;/PRE&gt;&lt;P&gt;Unfortunatly, I got the message:&lt;/P&gt;&lt;P&gt;Success connection&lt;/P&gt;&lt;P&gt;Uploading LisezmoiReadme.docx...&lt;/P&gt;&lt;P&gt;*cmd* 'TYPE I' *put* 'TYPE I\r\n'&lt;/P&gt;&lt;P&gt;*get* '200 Type set to I.\r\n'&lt;/P&gt;&lt;P&gt;*resp* '200 Type set to I.'&lt;/P&gt;&lt;P&gt;*cmd* 'PASV' *put* 'PASV\r\n'&lt;/P&gt;&lt;P&gt;*get* '227 Entering Passive Mode (142,34,138,110,197,108).\r\n'&lt;/P&gt;&lt;P&gt;*resp* '227 Entering Passive Mode (142,34,138,110,197,108).'&lt;/P&gt;&lt;P&gt;*cmd* 'STOR LisezmoiReadme.docx'&lt;/P&gt;&lt;P&gt;*put* 'STOR LisezmoiReadme.docx\r\n'&lt;/P&gt;&lt;P&gt;*get* '125 Data connection already open; Transfer starting.\r\n'&lt;/P&gt;&lt;P&gt;*resp* '125 Data connection already open; Transfer starting.'&lt;/P&gt;&lt;P&gt;*get* '425 Data channel timed out due to not meeting the minimum bandwidth requirement.\r\n'&lt;/P&gt;&lt;P&gt;*resp* '425 Data channel timed out due to not meeting the minimum bandwidth requirement.'&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #e23d39;"&gt;Error uploading file: 425 Data channel timed out due to not meeting the minimum bandwidth requirement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last line is the error and i dont know how to resolve it? Any help please? Is it better to use the transfercmd command?&lt;/P&gt;&lt;P&gt;I use ArcGIS 10.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461875#M36142</guid>
      <dc:creator>SaidAkif</dc:creator>
      <dc:date>2021-12-11T20:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461876#M36143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could you format the code block using syntax highlighting please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 21:46:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461876#M36143</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T21:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461877#M36144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This doesn't appear to have anything to do with ArcGIS. You might be better asking this question at &lt;A href="http://stackoverflow.com/"&gt;StackOverflow&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 23:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461877#M36144</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2015-12-01T23:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461878#M36145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really believe so. It is part of our skills to now how to retreive or save data in an ftp site&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Dec 2015 13:41:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461878#M36145</guid>
      <dc:creator>SaidAkif</dc:creator>
      <dc:date>2015-12-02T13:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461879#M36146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The point Luke is making is that is a computing skill and not a GIS skill per se, perhaps it is presumed erroneously that one has the former before one applies them to the latter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Dec 2015 14:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461879#M36146</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-02T14:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461880#M36147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all I resolve the problem&lt;/P&gt;&lt;P&gt;Here is the code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import ftplib 
from ftplib import FTP_TLS 
import os 
import sys 
 
server = XXXXXXXX
user = XXXXXXXXXXX
passwd = XXXXXXXXXXXXXX
PathFile = 'XXXXXXXXXXXXXXXXXXXXXX

def connect_ftp():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp = ftplib.FTP_TLS(timeout=10)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.connect(server, 21)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.auth()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.prot_p()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.login(user, passwd)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp.set_debuglevel(2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ftp
def upload_file(ftp_connection, upload_file_path):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upload_file1 = open(os.path.join(PathFile,upload_file_path), 'r')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Uploading ' + upload_file_path + "...")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.storbinary('STOR ' + upload_file_path, upload_file1, 1000)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.quit()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_connection.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upload_file1.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Upload finished.')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception, e:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Error uploading file: " + str(e))

ftp_conn = connect_ftp()
if ftp_conn:
&amp;nbsp;&amp;nbsp; print("Success connection")
&amp;nbsp;&amp;nbsp; upload_file(ftp_conn, 'LisezmoiReadme.docx')&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461880#M36147</guid>
      <dc:creator>SaidAkif</dc:creator>
      <dc:date>2021-12-11T20:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file in a secured FTP (FTPS)?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461881#M36148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Said,&lt;/P&gt;&lt;P&gt;Although it is while ago, how about if some one want to download .csv file from FTPS with&amp;nbsp; "Require explicit FTP over TLS".&lt;/P&gt;&lt;P&gt;I can download manually my.csv file in filezilla with the same protocol but unfortunately whenever I tried this in python timeout error coming up&amp;nbsp; while accessing&amp;nbsp; any LIST or DIR command from python ftplib. I am not sure what is going on? Any idea?&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2019 21:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-upload-a-file-in-a-secured-ftp-ftps/m-p/461881#M36148</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2019-04-10T21:42:04Z</dc:date>
    </item>
  </channel>
</rss>

