HI guys, it's been awhile since I've needed help. This should be simple, but something is not coming out right, I keep getting "The File Could Not be Uploaded because: A System Error occurred" which is case 6 in my script, but I'm not sure what is wrong with the script. If anyone could help me with this, I'd greatly appreciate it. I've built a similar script before, so I really don't know what I'm doing wrong now. . .
if (isset($POST['submitted'])) {
$un = $POST['un'];
$star = $POST['star'];
$newname = $POST['newname'];
// Check for an uploaded file.
if (isset($_FILES['upload'])) {
// Validate the type. Should be jpeg, jpg, or gif.
$allowed = array ('image/jpeg', 'image/jpg', 'image/pjpeg');
if (in_array($_FILES['upload']['type'], $allowed)) {
$filedid = $_FILES['upload']['name'];
require_once ('mysql_connect.php');
// Move the file over.
// Create index names to refer to the proper upload and description.
$filename = 'upload';
if (move_uploaded_file($_FILES['upload']['tmp_name'], "../images/artists/$star")) {
$query = "UPDATE artists SET picture='$newname' WHERE num='$un'";
$result = mysql_query($query);
if ($result) {
echo '<p><a href="http://www.badave.com/account/updates/daily.php">Return to Daily Updates</a>. The file has been uploaded! Please note that due to malicious uploaders, all images are subject to approval and are not accessible at time of upload. Generally speaking this is 24-48 hours depending on time of upload. Thank you for using Badave. Upon uploading a new primary image, your original image will be deleted as soon as the new one is approved.</p>';
include ('http://www.badave.com/scripts/footer.php');
exit();
} else { echo '<p>We apologize, but the picture failed to load</p>'; }
} else { // Couldn't move the file over.
echo '<p><font color="red">The file could not be uploaded because: </b>';
// Print a message based upon the error.
switch ($_FILES['upload']['error']) {
case 1:
print 'The file exceeds the File Size.';
break;
case 2:
print 'The file exceeds the Maz File Size';
break;
case 3:
print 'The file was only partially uploaded.';
break;
case 4:
print 'No file was uploaded.';
break;
case 6:
print 'No temporary folder was available.';
break;
default:
print 'A system error occurred.';
break;
} // End of switch.
print '</b></font></p>';
} // End of move... IF.
} else { // Invalid type.
echo '<p><font color="red">Please upload a JPEG or GIF image.</font></p>';
unlink ($_FILES['upload']['tmp_name']); // Delete the file.
}
} else { // No file uploaded.
echo '<p><font color="red">Please upload a JPEG or GIF image smaller than 512KB.</font></p>';
}[/B]