Jump to content

problem with specifying directory when using file_get_content()


Recommended Posts

problem with specifying directory when using file_get_content()

i got a problem with this function
sim.txt is the file that i wish to read. it is stored in website_root\color_scripts\sim.txt

this is my code

[b]$simtxt_contents = file_get_contents("color_scripts\sim.txt");[/b]

here is the error message

[b]
Warning: file_get_contents(color_scripts\sim.txt) [function.file-get-contents]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\website_root\test_colorsim.php on line 21[/b]

the strange thing is i specified the directory as "color_scripts\sim.txt" , and NOT \test_colorsim.php\

is there anyway to solve this problem?
do i need to escape ta directory up?
using apache on my computer
please help
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.