Forum Moderators: coopster

Message Too Old, No Replies

Binary file copies in PHP 4 < 4.3.0

Anybody know a quick way?

         

closed

6:36 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I can do this with PHP 4.3.3 (on my test machine):


<?php
$inFile = "http://mydomain.com/image.jpg";
$outFile = "myImage.jpg";
copy($inFile,$outFile);
?>

but apparently, not with 4.1.2. allow_url_fopen is enabled in both cases. Does anybody know a quick and efficient way to copy a binary file in PHP 4.1.2?

coopster

6:44 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you sure you have write access to the destination directory and the destination file?

closed

6:47 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Yes.

closed

6:56 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Never mind. Thanks for at least reading my message, coopster.

I figured it out. I ended up just copying most of php.net's fread example code. It works now.

coopster

7:03 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Out of curiosity, is your server a Windows platform?

closed

7:15 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I test on a Windows box, but the server I upload to uses *nix.

I use newer versions of Apache, PHP, and MySQL when I do my testing (on Windows), so I have to make sure everything works after I upload to the server.