swg1cor14
swg1cor14

Reputation: 1722

Cant access PHP generated files via FTP

I have a form that uploads files and stores them in an uploads folder in my httpdocs folder. However, if I try to delete or rename one of those files via ftp, it wont let me. Why?

Upvotes: 1

Views: 130

Answers (3)

Francesco Laurita
Francesco Laurita

Reputation: 23552

Why it happens has just been already answered.

You can avoid this by using the chmod function giving to the uploaded file the right permission.

Es:

chmod($filename,666)

see here: http://it.php.net/chmod

Upvotes: 1

Igoris
Igoris

Reputation: 1650

Because php works under apache username, so you don't have rights to delete other users files. You need to have apache in the same group as your username, or delete using apache username (by scripts, manually, etc.)

Upvotes: 2

Michael Berkowski
Michael Berkowski

Reputation: 270775

The user your web server runs as (apache, or perhaps www-data or httpd for Apache) probably owns the PHP-created files. The permissions on them may prevent your FTP user from writing to them.

Upvotes: 3

Related Questions