I've been working on a custom cms and I'm having trouble creating a form where a user can update the thumbnail associated with a given row. I have another page where they can do the initial upload, and it all works perfectly, but for some reason, even after copy and pasting the code directly to the update page, php returns errors for the following two lines:
move_uploaded_file($_FILES['thumbnail']['tmp_name'], "images/" . $_FILES['thumbnail']['name']);
$thumbnail_location = 'images/'. $_FILES['thumbnail']['name'];
The page leading to this one just contains a normal form where the upload input has a name of "thumbnail". Here is a little more of the related code although it does not seem to be the problem.
move_uploaded_file($_FILES['thumbnail']['tmp_name'], "images/" . $_FILES['thumbnail']['name']);
$thumbnail_location = 'images/'. $_FILES['thumbnail']['name'];
$id = $_GET['id'];
$workset = mysql_query('SELECT * FROM work WHERE id='.$id.' LIMIT 1', $connection);
while ($work = mysql_fetch_array($workset)) {
mysql_query('UPDATE work SET thumbnail="'.$thumbnail_location.'" WHERE id='.$id.'');
}