ag3nt42 Posted June 11, 2008 Share Posted June 11, 2008 anyone know how to write to a file that is up one directory? like if your in this directory\/: /root/myfile/install/I'm here and my file to write to is here: /root/myfile/ thanx in advance, ag3nt42 ps. I've tried using fopen("http://root/myfile"); but then i get a bad error cannot use Write through HTTP Quote Link to comment https://forums.phpfreaks.com/topic/109769-solved-fopenback-a-directory/ Share on other sites More sharing options...
Caesar Posted June 11, 2008 Share Posted June 11, 2008 Use relative paths. Assuming you're in the "/install" folder and your file is in the "/myfile" folder... <?php $handle = fopen('../myfile.txt', 'w'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/109769-solved-fopenback-a-directory/#findComment-563330 Share on other sites More sharing options...
ag3nt42 Posted June 11, 2008 Author Share Posted June 11, 2008 nice.. now does that only go backwards one directory? Quote Link to comment https://forums.phpfreaks.com/topic/109769-solved-fopenback-a-directory/#findComment-563342 Share on other sites More sharing options...
wildteen88 Posted June 11, 2008 Share Posted June 11, 2008 Yes. To go two levels use ../../myfile.txt three levels ../../../myfile.txt You see the patten yet? Quote Link to comment https://forums.phpfreaks.com/topic/109769-solved-fopenback-a-directory/#findComment-563346 Share on other sites More sharing options...
ag3nt42 Posted June 11, 2008 Author Share Posted June 11, 2008 yea right on.. you frikin rock man... thankx a million Quote Link to comment https://forums.phpfreaks.com/topic/109769-solved-fopenback-a-directory/#findComment-563347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.