Here's the code
Code: Select all
<?
$uploadd = $HTTP_POST_VARS['uploadd'];
echo "up: $uploadd :";
$uploaddir = '../../images/trucks/';
$num = (rand()%10000);
$imageName=$num . $_FILES['attachment']['name'];
$uploadfile = $uploaddir . $imageName;
echo "trying, $uploadfile <br>";
if (move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile)) {
echo "it's moved..";
///resize image
// Get new sizes
list($width, $height) = getimagesize($uploadfile);
$newwidth = 500;
$newheight = $height * ($newwidth/$width);
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($uploadfile);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb, $uploadfile);
echo "MOVED FIRST";
$img_size = GetImageSize($uploadfile);
$Width = $img_size[0];
$Height = $img_size[1];
echo "Check server for photo!!";
$images=$images.$imageName."`";
}
$i=0;
$keepgoing=true;
while($keepgoing){
$i++;
$fl="attachment$i";
echo ":: $fl";
if($_FILES["$fl"]){
echo "NEW FILE";
$num = (rand()%10000);
$imageName=$num . $_FILES["$fl"]['name'];
$uploadfile = $uploaddir . $imageName;
//$uploadfile = $uploaddir . $num . $_FILES["$fl"]['name'];
if (move_uploaded_file($_FILES["$fl"]['tmp_name'], $uploadfile)) {
$img_size = GetImageSize($uploadfile);
$Width = $img_size[0];
$Height = $img_size[1];
$images=$images.$imageName."`";
}
echo "images:$images";
}else{
$keepgoing=false;
return;
}
}
?>Also, it seems to always work on firefox, but working half the time in Safari.
=/
Any ideas?