PHP Classes

error download link

Recommend this page to a friend!

      QR code generator  >  All threads  >  error download link  >  (Un) Subscribe thread alerts  
Subject:error download link
Summary:error download link
Author:mustafa hamad
Date:2012-02-15 09:37:46
Update:2012-02-15 12:46:55

  1. error download link   Reply   Report abuse  
mustafa hamad - 2012-02-15 09:37:46
when download image get empty file
how i can download imag and save image on server?


  2. Re: error download link   Reply   Report abuse  
Arturs Sosins - 2012-02-15 12:46:55 - In reply to message 1 from mustafa hamad

I've updated the class, fixed download_image method to force image download dialog and created new method save_image to save image on the server.

Here is a quick example:

$qr = new qrcode();


//get QR cod eimage
$image = $qr->get_image();

//save image in same folder where script is
$qr->save_image($image, "./QRcode.png");

  3. Re: error download link   Reply   Report abuse  
K - 2014-12-09 03:07:17 - In reply to message 2 from Arturs Sosins

The PNG got downloaded to my host server. How do i download
to my PC.
Try this but not working

$file = 'QRCode.png';

if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));

  4. Re: error download link   Reply   Report abuse  
Arturs Sosins - 2014-12-09 09:40:57 - In reply to message 3 from K
It seems to me if file exists that it should have been forced to download

what is happening on your side?

  5. Re: error download link   Reply   Report abuse  
K - 2014-12-10 01:10:14 - In reply to message 4 from Arturs Sosins
The file got downloaded to server instead of my PC