472,127 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

How to FTP a ASCII file

Hi,

My program has the following code to transfer a binary file

f = open(pathanme+filename,'rb')
print "start transfer"
self.fthHandle.storbinary('STOR '+filename, f)

How can I do an ASCII file transfer??????
-Ted

Jul 2 '07 #1
2 3662
On Jul 3, 9:02 am, "tedpot...@gmail.com" <tedpot...@gmail.comwrote:
Hi,

My program has the following code to transfer a binary file

f = open(pathanme+filename,'rb')
print "start transfer"
self.fthHandle.storbinary('STOR '+filename, f)

How can I do an ASCII file transfer??????
-Ted
I'm really curious as to how you could find out how to upload a file
in binary mode, but not in ASCII mode.

According to The Fantastic Manual:
"""
storbinary( command, file[, blocksize])

Store a file in binary transfer mode. command should be an appropriate
"STOR" command: "STOR filename". file is an open file object which is
read until EOF using its read() method in blocks of size blocksize to
provide the data to be stored. The blocksize argument defaults to
8192. Changed in version 2.1: default for blocksize added.

storlines( command, file)

Store a file in ASCII transfer mode. command should be an appropriate
"STOR" command (see storbinary()). Lines are read until EOF from the
open file object file using its readline() method to provide the data
to be stored.
"""

Jul 2 '07 #2
On Jul 2, 7:12 pm, John Machin <sjmac...@lexicon.netwrote:
On Jul 3, 9:02 am, "tedpot...@gmail.com" <tedpot...@gmail.comwrote:
Hi,
My program has the following code to transfer a binary file
f = open(pathanme+filename,'rb')
print "start transfer"
self.fthHandle.storbinary('STOR '+filename, f)
How can I do anASCIIfile transfer??????
-Ted

I'm really curious as to how you could find out how to upload a file
in binary mode, but not inASCIImode.

According to The Fantastic Manual:
"""
storbinary( command, file[, blocksize])

Store a file in binary transfer mode. command should be an appropriate
"STOR" command: "STOR filename". file is an open file object which is
read until EOF using its read() method in blocks of size blocksize to
provide the data to be stored. The blocksize argument defaults to
8192. Changed in version 2.1: default for blocksize added.

storlines( command, file)

Store a file inASCIItransfer mode. command should be an appropriate
"STOR" command (see storbinary()). Lines are read until EOF from the
open file object file using its readline() method to provide the data
to be stored.
"""
Hi,
I did a google on python file transfer and got links to sample code
using a binary transfer, but thier was no links to sample code using
ascc. Thank you for your help

Jul 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Peter Wilkinson | last post: by
4 posts views Thread by webdev | last post: by
13 posts views Thread by greg | last post: by
7 posts views Thread by Jeffrey Spoon | last post: by
5 posts views Thread by Mike Currie | last post: by
18 posts views Thread by John | last post: by
4 posts views Thread by meendar | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.