I have this working Upload Image Form, that sends the uploaded image to /Upload/:
if ($form_submitted == 'yes') {
$allowedExts = array("gif", "jpeg", "jpg", "pdf", "doc", "docx", "txt", "rtf", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = strtolower( end($temp) );
if (!in_array($extension,$allowedExts) && $_FILES["file"]["name"] != "" )
{
echo ("<div id=\"errorMessage\">Error: Invalid File Name - Allowed File Formats: .doc .docx .gif .jpeg .jpg .rft .png .txt - Please go back and choose another</div>");
}
else if ($_FILES["file"]["size"] >= 100000)
{
echo ("<div class=\"errorMessage1\">Error: Image File Size Exceeds Limit - Go Back - Choose Another Smaller Image File Size</div>");
}
$length = 20;
$randomString = (time());
$thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
$sql = "INSERT INTO videos ( filename ) VALUES( '$thumbnail' )";
mysql_query($sql);
$file_location = website name witheld/upload/
}
I’d like the uploaded image to go to where the thumbnails are stored, but I’m not sure where that is. I know that this code copies the avatar as the video thumbnail:
{
$sql = "SELECT file_name FROM pictures WHERE user_id = $user_id LIMIT 1";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$pic_file = $row['file_name'];
$output_file = $base_path."/uploads/thumbs/".$file_name_no_extension.'.jpg';
$input_file = $base_path."/pictures/".$pic_file;
//echo "Input file = ".$input_file;
echo " and Output file = ".$output_file."<br>";
copy($input_file, $output_file);
}
@mysql_close();
}
From this code, can you tell me how to add where the thumbnails are stored code, so I to the Upload Image Form?