tags:

views:

228

answers:

4

hi ,

i am getting file content from file_get_content funtion in php. and want to store that file in particular folder.

how could i store that file in particular folder.

$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');

i want to save this image in particular folder.

any idea abt it?

+4  A: 

Use file_put_contents()

$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
file_put_contents('./myDir/myFile.gif', $image);
Yacoby
A: 

If you're using php 5, you can use file_put_contents:

file_put_contents('/path/to/file.dat', $data);

adam
A: 

file_put_contents()?

Stefan Gehrig
A: 

Apart from the mentioned file_put_contents, you could take a look at the example of the fwrite function.

Boldewyn