Binary/ASCII File upload issues

Martin Paredes mapsware at prodigy.net.mx
Thu Oct 21 00:56:44 PDT 2004


On Monday 18 October 2004 02:43, nocturnal wrote:
> if i do file index.php on a file i uploaded that works just
> fine with php ran as cgi i get "/path/index.php: a
> /usr/local/bin/php script text executable" and if i do file
> index.php on a customers index.php file which i think they
> uploaded using binary transfer mode i get "script text
> executable/bin/php" only, the second file doesn't work using
> php as cgi, i get an internal server error, i know how to
> fix this but i'm wondering if anyone could explain why this
> happens on freebsd and if it's related to the ftp transfer

if you transfer a file from unix to unix system, always use binary.
but if you transfer from window to unix, you need to know if the file is text 
or binary

In windows, make a file that contain the next line and transfer in binary
Line1
Line2

In the unix edit the file with vi an you will see
Line1^M
Line2

In windows, the new line is conformed with 2 characters (10 and 13) and in 
unix with 1 character (13)

when you tranfer in ascii, the strings [10][13] are converted to [13]

maybe this extra character is the problem.

maps



More information about the freebsd-questions mailing list