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
Messages:5
Author:mustafa hamad
Date:2012-02-15 09:37:46
Update:2012-02-15 12:46:55
 

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

thx

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

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:

<?php
include("qrcode.php");
$qr = new qrcode();

//link
$qr->link("http://webcodingeasy.com");

//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  
Picture of K K - 2014-12-09 03:07:17 - In reply to message 2 from Arturs Sosins
Hello,

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

<?php
$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));
readfile($file);
exit;
}
?>

  4. Re: error download link   Reply   Report abuse  
Picture of Arturs Sosins 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  
Picture of K 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