Reply to Re: force download

Re: force download new!
by colin, 8 years, 3 months ago
I just noticed, your code is incorrect, you call process() twice, and wrongly check on processed too soon. Try this:

include('lib/class.upload.php');
$file = "image.jpg";
$files = "new-image.jpg";

$handle = new upload($file);
if ($handle->uploaded) {
  $handle->file_new_name_body   = $files;
  $handle->image_resize         = true;
  $handle->image_y              = 400;
  $handle->image_ratio_x        = true;
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename='.basename($files));						
  echo $handle->process();
  die();		
} else {
  echo 'error : ' . $handle->error;
}
Reply

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