I am using Xampp for web developing. For Many years I am writing data or saving images through php scripts. But for the current project, even though I have created a folder as usual for saving images, no idea why, the folder automatically changes to read-only, and Image is NOT saved to it. I manually tried to change the permissions, that too NOT working D://xampp/htdocs/sitename/foldername/
Asked
Active
Viewed 263 times
1 Answers
0
is it really on D:// ?? because by default xampp on windows usually on C partition. but yah.. we possibly install it on D too by custom.
first, when you put local directory in php it should be : D:/xampp/htdocs/sitename/foldername/ (without double slash).
example :
<?php
$myfile = fopen("d:/xampp/htdocs/sitename/foldername/newfile.txt", "w") or die("Unable to open file!");
$txt = "Hello world\n";
fwrite($myfile, $txt);
$txt = "Hello World\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
second, ensure folder permission set to 777
third, if that directory was outside webroot directory you can try this : enter link description here

hironaga
- 1
- 2
-
1)I am doing so many writing operations in other projects, with out any difficulty. Only this one is giving me trouble. 2) Xampp. while installing they give a warning NOT to install in C drive, because tha may give permission issues. So I installed in D – Padhoo Nov 27 '20 at 05:48