Click to See Complete Forum and Search --> : [Resolved] storing outside htdocs folder on Win/iis/php/mysql


benja
05-04-2005, 10:31 PM
i need to dump some images (pictures) located on a mySQL DB to the filesystem.

The problem is that the disc (c:) where the wwwroot and DB is located is nearly out of space. (i cant change this configuration)

Is there a way i can do a php script that writes on another fisical disc (d:) ?

thanks in advance

bradgrafelman
05-21-2005, 05:37 PM
Sure... PHP recognizes Windows drive letters, so just open a path where there is more space, such as:

$fp = fopen('D:/backup/bigFile.txt');
fwrite($fp, $LargeAmountOfData . $MoreAndMoreData . $etc);
fclose($fp);

EDIT: PHP also recognizes UNC paths (I believe), so you could even dump the data to a different server:

$fp = fopen('\\\\FileServer1\\c$\\Webserver_backup\\\bigFile.txt');
fwrite($fp, $LargeAmountOfData . $MoreAndMoreData . $etc);
fclose($fp);

benja
05-22-2005, 12:12 AM
Thanks, works great