class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
include('/uploadclass/class.upload.php');
function makeMyDir($inDirName) {
$dirArray = split('/', $inDirName);
$dirName = '/';
foreach ($dirArray as $dirLevel) {
$dirName .= $dirLevel.'/';
if (!file_exists($dirName)) {
mkdir($dirName, 0755);
}
}
}
echo 'Upload result:'; // At least one symbol should be sent to response!!!
$uploaddir = $_SERVER['DOCUMENT_ROOT']."/uploads/"; // path to images
makeMyDir($uploaddir );
if(count($_FILES) > 0) {
$arrfile = pos($_FILES);
$uploadfile = $uploaddir . basename($arrfile['name']);
if (move_uploaded_file($arrfile['tmp_name'], $uploadfile))
//FILE IS IN RIGHT DIRECTORY, START THE FUNKY IMAGE HANDLING NOW
$handle = new Upload($uploadfile);
$handle->file_new_name_body = strtotime("now");
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 1024;
$handle->image_convert = 'jpg';
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->process($uploadfile);
echo "File is valid, and was successfully uploaded.\n";
} else
echo 'No files sent. Script is OK!'; //Say to Flash that script exists and can receive files
echo 'Here is some more debugging info:';
print_r($_FILES);
include('/uploadclass/class.upload.php'); function makeMyDir($inDirName) { $dirArray = split('/', $inDirName); $dirName = '/'; foreach ($dirArray as $dirLevel) { $dirName .= $dirLevel.'/'; if (!file_exists($dirName)) { mkdir($dirName, 0755); } } } echo 'Upload result:'; // At least one symbol should be sent to response!!! $uploaddir = $_SERVER['DOCUMENT_ROOT']."/uploads/"; // path to images makeMyDir($uploaddir ); if(count($_FILES) > 0) { $arrfile = pos($_FILES); $uploadfile = $uploaddir . basename($arrfile['name']); if (move_uploaded_file($arrfile['tmp_name'], $uploadfile)) //FILE IS IN RIGHT DIRECTORY, START THE FUNKY IMAGE HANDLING NOW $handle = new Upload($uploadfile); $handle->file_new_name_body = strtotime("now"); $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 1024; $handle->image_convert = 'jpg'; $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->process($uploadfile); echo "File is valid, and was successfully uploaded.\n"; } else echo 'No files sent. Script is OK!'; //Say to Flash that script exists and can receive files echo 'Here is some more debugging info:'; print_r($_FILES);You say it doesn't work yet. But does it work in some parts? What do you have working?
When you process the file, what $handle->log says?