absolute vs relative paths
Posted: Mon Jun 21, 2004 12:17 pm
hi, this is a follow up to a question i posted yesterday. I'm a newbie when it comes to php so this may be very basic i don't know. i have a flash movie sending certain vars to a php script that in turn copies them to a .txt file. the PHP script looks like this
<?php
$value0 = $_POST['value0'];
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
$value3 = $_POST['value3'];
$value4 = $_POST['value4'];
$value5 = $_POST['value5'];
$testvar = "sunset.txt";
$contents = "&value0=".$value0."&value1=".$value1."&value2=".$value2."&value3=".$value3."&value4=".$value4."&value5=".$value5;
$filename = fopen( $testvar, "w");
fwrite($filename, $contents, 10000);
fclose ($filename);
?>
This php script works ok. But i am trying to change line 7 in the script
$testvar = "sunset.txt"; from the relative path to an absolute path
i should mention at this point i am working with on Mac osX and am working locally, not on the internet.
to launch the php script localy i use this in the address bar
'http://myHarddrive.local/~andreas/info/sunset.php'
i thought that the absolute path to the file sunset.txt would be
http://myHarddrive.local/~andreas/info/sunset.txt but when i use this path in line 7 of the php code the script no longer works. Does anyone have any ideas as to what the absolute path should be?
<?php
$value0 = $_POST['value0'];
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
$value3 = $_POST['value3'];
$value4 = $_POST['value4'];
$value5 = $_POST['value5'];
$testvar = "sunset.txt";
$contents = "&value0=".$value0."&value1=".$value1."&value2=".$value2."&value3=".$value3."&value4=".$value4."&value5=".$value5;
$filename = fopen( $testvar, "w");
fwrite($filename, $contents, 10000);
fclose ($filename);
?>
This php script works ok. But i am trying to change line 7 in the script
$testvar = "sunset.txt"; from the relative path to an absolute path
i should mention at this point i am working with on Mac osX and am working locally, not on the internet.
to launch the php script localy i use this in the address bar
'http://myHarddrive.local/~andreas/info/sunset.php'
i thought that the absolute path to the file sunset.txt would be
http://myHarddrive.local/~andreas/info/sunset.txt but when i use this path in line 7 of the php code the script no longer works. Does anyone have any ideas as to what the absolute path should be?