Reply to Errors on upload/resize?

Errors on upload/resize? new!
by Murray Summers, 12 years, 11 months ago
Can anyone see why this code would be giving me the errors shown (I have included light debugging code)? Yet, when I run the distributed upload-index.php file, it works fine!

The image appears to upload fine, since I can see the temp file in the destination folder. But that's all I get....

// ---------- IMAGE UPLOAD ----------

// we create an instance of the class, giving as argument the PHP object
// corresponding to the file field from the form
// All the uploads are accessible from the PHP object $_FILES
$handle = new Upload($_FILES['image1']);

// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle->uploaded) {
echo "uploaded";
echo $handle->file_src_name;

// yes, the file is on the server
// below are some example settings which can be used if the uploaded file is an image.
$handle->image_resize            = true;
$handle->image_ratio_y           = true;
$handle->image_x                 = 169;
$handle->image_border              = '1px';
$handle->image_border_color      = '#FFFFFF';
$handle->image_watermark          = '_img/logotree-watermark3.png';
$handle->file_overwrite          = true;

// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/my_uploads/');

$handle->Process($dir_dest);

echo "
" . $handle->file_dst_path . "";
echo $handle->file_dst_name . "";

// we check if everything went OK
if ($handle->processed) {
  // everything was fine !
  echo 'file uploaded with success';
  echo $handle->file_dst_name;
  $info = getimagesize($handle->file_dst_pathname);
  echo '' . $info['mime'] . '  -  ' . $info[0] . ' x ' . $info[1] .'  -  '
    . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB';
  echo '  link to the file just uploaded: ' . $dir_pics.'/' . $handle->file_dst_name;
} else {
  // one error occured
  echo 'file not uploaded to the wanted location';
  echo '  Error: ' . $handle->error . '';
}

// we now process the image a second time, with some other settings
$handle->image_resize            = true;
$handle->image_ratio_y           = true;
$handle->image_x                 = 84;
$handle->image_border              = '1px';
$handle->image_border_color      = '#FF0000';
$handle->file_new_name_body      = 'foo2'; 
$handle->file_overwrite          = true;

$handle->Process($dir_dest);

ERRORS

file not uploaded to the wanted location Error: Error copying file on the server. copy() failed.
file not uploaded to the wanted location Error: No correct temp source file. Can't carry on a process.


PHP Warning: copy(test2\32f7981c7c7564468c0a3048b6f27d55.jpg) [function.copy]: failed to open stream: No such file or directory in W:\Webspace\murray99\gwssite\savannahweddings.com\www\_class\class.upload.php on line 4960 PHP Warning: unlink(test2\32f7981c7c7564468c0a3048b6f27d55.jpg) [function.unlink]: No such file or directory in W:\Webspace\murray99\gwssite\savannahweddings.com\www\_class\class.upload.php on line 5004Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important