This is a basic image upload script, that when a user uploads a file it should move it to his folder that is created when he registers, then it inserts the location of the photo into a database. It will run on an apache mysql set up I have on my computer but then I uploaded it to my host and it does not seem to work?
class Photo extends Session {
function profile_photo($img) {
$this->start_session();
$uid = $_SESSION['userid'];
$tmpname = $_FILES['image']['tmp_name'];
$randname = rand(1, 1000000);
$type = preg_match('/.tmp/', $tmpname);
move_uploaded_file($tmpname, "user/$uid/$randname.jpg");
$sql = "INSERT INTO user_images (image_url, user_id) VALUES ('user/$uid/$randname.jpg', '$uid')";
$q = mysql_query($sql);
header("Location: home.php");
}
}
File Permessions are 777
It is inserting into the database just the move_uploaded_file function does not seam to be moving the uploaded file?