Page 1 of 1

FTP and Creating New Files

Posted: Tue Jan 04, 2005 5:26 pm
by Mr Tech
Hey there,

I have written a PHP script that can create, edit and delete PHP files on the web server.

My script is used on my clients websites which use CPanel, so all of the files and folders are saved in the /public_html/ folder.

I currently use this code to create a file in the /public_html/ folder:

Code: Select all

<?php
$fp=fopen("filename.php",w);
fputs($fp,$content);
fclose($fp);
?>
Which works fine ONLY if the /public_html/ folder is CHMODed to 777.

However, their host have an automatic script that changes the CHMOD of the /public_html/ folder to 750 resulting in my script not being able to create files.

Is there a way to create new files without having the /public_html/ folder set to 777?

Cheers

Ben

Posted: Tue Jan 04, 2005 5:37 pm
by feyd
there's a potential to ftp it into the folder... just write the file to a writable location (like a temporary folder or something) then ftp it into place.

Posted: Tue Jan 04, 2005 5:47 pm
by Mr Tech
Thanks mate :)

Is it possible to move a file into an unwriteable folder without FTP at all?

Thanks

Ben

Posted: Tue Jan 04, 2005 6:07 pm
by feyd
you can try it, but I'd say no.