Hi there. Having a small issue in formulating a file upload to my directory. I have properly added the extension to my mysql database (added along with other registration information), but am having a problem putting the file in the directory. Everything else works perfectly, but can’t seem to properly move the uploaded file to my directory.
If anyone can spot my oversight, I would be very grateful. Thanks in advance for taking a moment to provide your input.
Here is the relevant php:
$user_pic = $_FILES['user_pic'];
$id = mysql_insert_id();
$newname = "avatar.jpg";
$location = "members/$id/pictures/$newname";
mkdir("members/$id", 0755);
mkdir("members/$id/pictures", 0755, true);
$name = $_FILES['user_pic']['name'];
$tmp_name = $_FILES['user_pic']['tmp_name'];
move_uploaded_file($tmp_name, "members/$id/pictures/".$newname);
And the form portion:
<input type='hidden' name='MAX_FILE_SIZE' value='16777216'>
<td width="521"><input name="user_pic" type="file" class="formFields" size="42" /> 2mb max</td>
Thanks again for looking at my problem.