Aug 9, 2011
tom

Directory and files stuck on server after upload

Question

I’ve uploaded some files into a directory i’ve created (using a php upload script). At first I didn’t set the right chmod for dir. and files (411 instead of 777). Now this folder and files are stuck on the server, can’t delete using FTP, cant delete using script: unlink/rmdir. I don’t have server acces. Is there any way to still do this using PHP scripting?

Answer

If

chmod ("/somedir/somefile", 755); // php script code

does not work you still can try

unlink($filename);  // php script code

and

rmdir($dirname);  // php script code

to remove them. If this does not work then your apache-account on the server does not have the necessary rights to do that. I guess this should usually work cause your apache-account created those files.

Related posts:

  1. How to give PHP permissions to write to files without globally opening up permissions to the directory
  2. PHP Image upload folder
  3. Linux FTP upload: “No such file or directory”, but file exists
  4. How can I prevent people from looking at a listing of files in parent directory if I haven’t uploaded index.html?
  5. PHP Session File Stored in Temp Directory – Apache

Leave a comment