Help - Search - Members - Calendar
Full Version: Fail To Create A New File
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Alan YLC
I try to create a new file by using fopen. But I received the following warnigs:

Warning: fopen(filename.txt) [function.fopen]: failed to open stream: Permission denied

Warning: fclose(): supplied argument is not a valid stream resource

How can I have the permissioin? Or any other method to solve?
swordz
You should specify a folder - try ./filename.txt

Swordz
Alan YLC
Thanks for helping.
But, may I ask why './' is need, is it a kind of syntax??
swordz
./ means 'current folder'.

It just helps to be more specific about these things - some file systems do accept without, and 'guess' the current folder. But if you always specify, it always works.

Swordz
brat_coffein
anyone can help me? i recieve a message when i'm trying to upload the file:
QUOTE
Warning: move_uploaded_file(./house/image_name.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /www/zxq.net/p/o/z/pozitive/htdocs/insert.php on line 14

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/www/zxq.net/p/o/z/pozitive/htdocs/phpr0OnwD' to './house/image_name.jpg' in /www/zxq.net/p/o/z/pozitive/htdocs/insert.php on line 14

and the line 14 of the script says:
CODE
$link = "./house/".$_FILES["image"]["name"];
move_uploaded_file($_FILES["image"]["tmp_name"],$link);

how can i solve it?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.