note 53796 added to function.move-uploaded-file

From: Date: Mon, 13 Jun 2005 18:42:34 +0000
Subject: note 53796 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-90369@lists.php.net to get a copy of this message
I'm really going out of my mind. I have a random picture script that is beyond the scope of this message but at one point it lets a user upload a file via the code: foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "userfiles/".$_POST['username']."/$name"); if(chmod("userfiles/".$_POST['username']."/$name", 0777)) { chown("jimmyjoe"); echo "successfully changed permissions"; } else { echo "UNFADFASDFAsdf"; } } } As you can see I'm "chown"ing the file afterwards and it DOES set the permissions correctly (I can confirm this via FTP) But I, as the admin, can not delete the picture (or therefore the folder containing it)... so right now my users can create and upload pictures etc and I have no way of deleting them... What should I do? ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53796 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53796&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53796&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53796&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53796&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53796&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53796&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90369) next »