Page 1 of 1

Determining FTP_ASCII or FTP_BINARY

Posted: Mon Aug 04, 2008 10:18 am
by kendall
i am using ftp_put to upload files to the server. However How do you determine what mode to use for files like word, excel and pdf? as i no images would be binary.

Whats the best way to check if the file is ASCII or BINARY?

Re: Determining FTP_ASCII or FTP_BINARY

Posted: Mon Aug 04, 2008 6:51 pm
by yacahuma
do the file have extensions?
I will use that to start with

Re: Determining FTP_ASCII or FTP_BINARY

Posted: Mon Aug 04, 2008 7:27 pm
by califdon
kendall wrote:i am using ftp_put to upload files to the server. However How do you determine what mode to use for files like word, excel and pdf? as i no images would be binary.

Whats the best way to check if the file is ASCII or BINARY?
For uploading unknown files, I think I'd just always make it binary. File extensions can be misleading. I don't know of any reliable way to determine in advance whether a remote file is ASCII or not.

Re: Determining FTP_ASCII or FTP_BINARY

Posted: Mon Aug 04, 2008 7:29 pm
by kendall
hmmm....thanks calif...i was running a preg_match on file ext....will using binary make text based files readable? as these files maye need to be "included" or fread

Re: Determining FTP_ASCII or FTP_BINARY

Posted: Mon Aug 04, 2008 9:06 pm
by califdon
To the best of my knowledge, ftp binary mode will read any file. I *think* ASCII mode is just a little more efficient if the file contains nothing but ASCII characters. Here's a pertinent thread on another forum: http://www.velocityreviews.com/forums/t ... inary.html