[eluser]trinic[/eluser]
I have this file(uploadify.php):
Code:
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = dirname(__FILE__).'/../'. trim($_REQUEST['folder'], '/') . '/';
$dateForUnique = time();
$myfilename = preg_replace('/[^A-Za-z0-9_]/', "", $tempFile );
// get the first char of the tagetfile name, and, make sure we move it into the
// correct sub directory too (for vcdb)
$randHex = substr(md5(rand()), 0, 16);
if (strstr($targetPath,'vcdbuploads')) {
$firstChar = substr($randHex,0,1);
$targetPath .= $firstChar . '/';
}
//echo($targetPath."\n\n");
//$myLocation = $dateForUnique . $_FILES['Filedata'] .
$dateForUnique = $randHex . $dateForUnique;
$targetFile = str_replace('//','/',$targetPath) . $dateForUnique . $myfilename;
$myarray = array("location"=> $dateForUnique . $myfilename);
$mynameext = explode(".",$_FILES['Filedata']['name']);
$mynameext = end($mynameext);
$targetFile .= "." . $mynameext;
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES['Filedata']['name']);
// if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
//echo($targetFile);
//print_r($_FILES);
//echo "\n<testte>\n";
//echo $tempFile;
//echo "\n<test>\n";
//echo $targetFile;
//echo "\n<test>\n";
move_uploaded_file($tempFile,$targetFile);
//echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
//echo json_encode($myarray);
echo($dateForUnique.$myfilename.'.'.$mynameext);
// } else {
// echo 'Invalid file type.';
// }
}
?>
I'm wanting to add the bit of image moo code that crop_rotates an image and save it in to a thumbnail. Where would I put the image moo code to do that? I tried to put it at the bottom and caught http errors