You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anil Philip <go...@yahoo.com> on 2006/08/24 16:58:10 UTC

[commons-ftp] newbie qs. can I simply set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?

Hello,
I need to send across both text and audio files from
Windows desktop to Linux server. 
Instead of keeping track of which is binary and which
is ascii and setting the flag each time, can I simply
set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?
thanks,
Anil

for good news go to http://members.tripod.com/~goodnewsforyou/goodnews.html

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [commons-ftp] newbie qs. can I simply set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?

Posted by Anil Philip <go...@yahoo.com>.
It is more confusing - I just now, noticed there is an
FTP.IMAGE_FILE_TYPE
So how is this different from FTP.BINARY_FILE_TYPE?
Can I transfer jpg as FTP.BINARY_FILE_TYPE?
-
Anil


--- Kevin Cummings <Ke...@cs.oag.state.tx.us>
wrote:

> I don't believe that is the problem. I thought just
> as you do that
> transferring ASCII data in BINARY mode should work
> because the ASCII
> character range is within the binary range, and when
> I used windows ftp
> command to send an ASCII file in BIN mode I was able
> to download the
> same file in BIN mode and then open it, but that
> does not work for my
> automated FTP code. Basically, I would end up with a
> file that was the
> correct size, i.e. the file on the FTP server
> matched that of the file I
> sent but when I opened the file in a text editor it
> was essentially
> empty. If I opened the file in a BINARY aware editor
> like EditPlus it
> would open in BINARY data view and the file was
> basically full of
> spaces. What causes the problem is a bit of a
> mystery, but I was able to
> find some hints online about how to write code to
> make a best guess as
> to a files contents and then set the transfer mode
> that way. Also, if
> the Commons FTP library has an AUTO mode you can try
> using that so it
> will transfer the file in the correct mode.
>  
>
-------------------------------------------------------------------
> Kevin Cummings
> IT/Systems Development
> Child Support Division
> Texas Office of the Attorney General
> Email: kevin.cummings@cs.oag.state.tx.us
> Phone: (512) 460-6421
> Fax: (512) 460-6800
>
-------------------------------------------------------------------
> 
> >>> Anil Philip <go...@yahoo.com> 8/24/2006
> 10:09 AM >>>
> 
> 
> Is it because of the cr-lf problem between DOS-Unix?
> For example, if I send across the jpg in a html
> file,
> and it was set as ascii, will it not display
> properly?
> I know for certain that audio files were not playing
> properly because I did not realize I had to
> setFileType to binary.
> -
> Anil
> 
> --- Kevin Cummings
> <Ke...@cs.oag.state.tx.us>
> wrote:
> 
> > I've not tried this with Commons FTP but I can
> tell
> > you from experience
> > with other FTP packages that this is not a good
> > idea. You'll basically
> > end up with files that have the right size but are
> > unreadable in a text
> > editor.
> >  
> > You're better off setting the indicator based on
> > what you know about
> > the file.
> >  
> > Good Luck!
> > .:. Kevin
> >  
> >
>
-------------------------------------------------------------------
> > Kevin Cummings
> > IT/Systems Development
> > Child Support Division
> > Texas Office of the Attorney General
> > Email: kevin.cummings@cs.oag.state.tx.us
> > Phone: (512) 460-6421
> > Fax: (512) 460-6800
> >
>
-------------------------------------------------------------------
> > 
> > >>> Anil Philip <go...@yahoo.com>
> 8/24/2006
> > 9:58 AM >>>
> > 
> > Hello,
> > I need to send across both text and audio files
> from
> > Windows desktop to Linux server. 
> > Instead of keeping track of which is binary and
> > which
> > is ascii and setting the flag each time, can I
> > simply
> > set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?
> > thanks,
> > Anil
> > 
> > for good news go to
> >
>
http://members.tripod.com/~goodnewsforyou/goodnews.html
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > 
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [commons-ftp] newbie qs. can I simply set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?

Posted by Kevin Cummings <Ke...@cs.oag.state.tx.us>.
I don't believe that is the problem. I thought just as you do that
transferring ASCII data in BINARY mode should work because the ASCII
character range is within the binary range, and when I used windows ftp
command to send an ASCII file in BIN mode I was able to download the
same file in BIN mode and then open it, but that does not work for my
automated FTP code. Basically, I would end up with a file that was the
correct size, i.e. the file on the FTP server matched that of the file I
sent but when I opened the file in a text editor it was essentially
empty. If I opened the file in a BINARY aware editor like EditPlus it
would open in BINARY data view and the file was basically full of
spaces. What causes the problem is a bit of a mystery, but I was able to
find some hints online about how to write code to make a best guess as
to a files contents and then set the transfer mode that way. Also, if
the Commons FTP library has an AUTO mode you can try using that so it
will transfer the file in the correct mode.
 
-------------------------------------------------------------------
Kevin Cummings
IT/Systems Development
Child Support Division
Texas Office of the Attorney General
Email: kevin.cummings@cs.oag.state.tx.us
Phone: (512) 460-6421
Fax: (512) 460-6800
-------------------------------------------------------------------

>>> Anil Philip <go...@yahoo.com> 8/24/2006 10:09 AM >>>


Is it because of the cr-lf problem between DOS-Unix?
For example, if I send across the jpg in a html file,
and it was set as ascii, will it not display properly?
I know for certain that audio files were not playing
properly because I did not realize I had to
setFileType to binary.
-
Anil

--- Kevin Cummings <Ke...@cs.oag.state.tx.us>
wrote:

> I've not tried this with Commons FTP but I can tell
> you from experience
> with other FTP packages that this is not a good
> idea. You'll basically
> end up with files that have the right size but are
> unreadable in a text
> editor.
>  
> You're better off setting the indicator based on
> what you know about
> the file.
>  
> Good Luck!
> .:. Kevin
>  
>
-------------------------------------------------------------------
> Kevin Cummings
> IT/Systems Development
> Child Support Division
> Texas Office of the Attorney General
> Email: kevin.cummings@cs.oag.state.tx.us
> Phone: (512) 460-6421
> Fax: (512) 460-6800
>
-------------------------------------------------------------------
> 
> >>> Anil Philip <go...@yahoo.com> 8/24/2006
> 9:58 AM >>>
> 
> Hello,
> I need to send across both text and audio files from
> Windows desktop to Linux server. 
> Instead of keeping track of which is binary and
> which
> is ascii and setting the flag each time, can I
> simply
> set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?
> thanks,
> Anil
> 
> for good news go to
>
http://members.tripod.com/~goodnewsforyou/goodnews.html
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



Re: [commons-ftp] newbie qs. can I simply set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?

Posted by Anil Philip <go...@yahoo.com>.
Is it because of the cr-lf problem between DOS-Unix?
For example, if I send across the jpg in a html file,
and it was set as ascii, will it not display properly?
I know for certain that audio files were not playing
properly because I did not realize I had to
setFileType to binary.
-
Anil

--- Kevin Cummings <Ke...@cs.oag.state.tx.us>
wrote:

> I've not tried this with Commons FTP but I can tell
> you from experience
> with other FTP packages that this is not a good
> idea. You'll basically
> end up with files that have the right size but are
> unreadable in a text
> editor.
>  
> You're better off setting the indicator based on
> what you know about
> the file.
>  
> Good Luck!
> .:. Kevin
>  
>
-------------------------------------------------------------------
> Kevin Cummings
> IT/Systems Development
> Child Support Division
> Texas Office of the Attorney General
> Email: kevin.cummings@cs.oag.state.tx.us
> Phone: (512) 460-6421
> Fax: (512) 460-6800
>
-------------------------------------------------------------------
> 
> >>> Anil Philip <go...@yahoo.com> 8/24/2006
> 9:58 AM >>>
> 
> Hello,
> I need to send across both text and audio files from
> Windows desktop to Linux server. 
> Instead of keeping track of which is binary and
> which
> is ascii and setting the flag each time, can I
> simply
> set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?
> thanks,
> Anil
> 
> for good news go to
>
http://members.tripod.com/~goodnewsforyou/goodnews.html
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [commons-ftp] newbie qs. can I simply set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?

Posted by Kevin Cummings <Ke...@cs.oag.state.tx.us>.
I've not tried this with Commons FTP but I can tell you from experience
with other FTP packages that this is not a good idea. You'll basically
end up with files that have the right size but are unreadable in a text
editor.
 
You're better off setting the indicator based on what you know about
the file.
 
Good Luck!
.:. Kevin
 
-------------------------------------------------------------------
Kevin Cummings
IT/Systems Development
Child Support Division
Texas Office of the Attorney General
Email: kevin.cummings@cs.oag.state.tx.us
Phone: (512) 460-6421
Fax: (512) 460-6800
-------------------------------------------------------------------

>>> Anil Philip <go...@yahoo.com> 8/24/2006 9:58 AM >>>

Hello,
I need to send across both text and audio files from
Windows desktop to Linux server. 
Instead of keeping track of which is binary and which
is ascii and setting the flag each time, can I simply
set FTPClient.setFileType(FTP.BINARY_FILE_TYPE)?
thanks,
Anil

for good news go to
http://members.tripod.com/~goodnewsforyou/goodnews.html

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org