CodeIgniter Forums
CI 2.0.2 weird behaviour - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI 2.0.2 weird behaviour (/showthread.php?tid=41219)



CI 2.0.2 weird behaviour - El Forum - 05-02-2011

[eluser]runrun[/eluser]
Code:
write_file("html/".basename($htmlfile), $str);

That is what I've always used to write files to the folder html in my root. Now with CI 2.0.2. that code will still work, but the code below will not.

Code:
write_file("new_html/".basename($htmlfile), $str);

You can see I changed the folder name to new_html, the code will not write anything to that folder. but if I change back to html the code works again.


CI 2.0.2 weird behaviour - El Forum - 05-02-2011

[eluser]InsiteFX[/eluser]
Code:
Note: The path is relative to your main site index.php file, NOT your controller or view files. CodeIgniter uses a front controller so paths are always relative to the main site index.

InsiteFX


CI 2.0.2 weird behaviour - El Forum - 05-02-2011

[eluser]runrun[/eluser]
html and new_html folder is on the same directory.

In CI 2.0.2:

Code:
write_file("html/".basename($htmlfile), $str); // will work

write_file("new_html/".basename($htmlfile), $str); // will not work

In CI 1.7.2:

Both codes will work.


CI 2.0.2 weird behaviour - El Forum - 05-02-2011

[eluser]Ken Verhaegen[/eluser]
My guess is that the '_' (Underscore) is blocked?


CI 2.0.2 weird behaviour - El Forum - 05-02-2011

[eluser]John_Betong_002[/eluser]
Try this:

Code:
// DEBUG;
error_reporting(-1); // added
ini_set('display_errors',1); // added
echo '<br />before: ' ."html/".basename($htmlfile);  
echo '<br />after:  ' .getcwd() ."/" .basename($htmlfile);

write_file(getcwd() . "/" .basename($htmlfile), $str); // will work
&nbsp;
&nbsp;


CI 2.0.2 weird behaviour - El Forum - 05-03-2011

[eluser]sblaas[/eluser]
[quote author="runrun" date="1304346448"]html and new_html folder is on the same directory.

In CI 2.0.2:

Code:
write_file("html/".basename($htmlfile), $str); // will work

write_file("new_html/".basename($htmlfile), $str); // will not work

In CI 1.7.2:

Both codes will work.[/quote]

Also both on the same directory structure ?

My best guess: in your 2.x environment the "new_html" isn't writable..


CI 2.0.2 weird behaviour - El Forum - 05-03-2011

[eluser]InsiteFX[/eluser]
What OS are you running?

InsiteFX


CI 2.0.2 weird behaviour - El Forum - 05-03-2011

[eluser]runrun[/eluser]
windows 7 32bit.


CI 2.0.2 weird behaviour - El Forum - 05-03-2011

[eluser]InsiteFX[/eluser]
Right click on the directory name, then properties if the read only checkbox is blue click on it until it goe's blank!

You should be logged in as administrator also.

InsiteFX