Welcome Guest, Not a member yet? Register   Sign In
Force download shows a blank page!
#1

Hi;

Not sure why forcedownload shows a blank page Sad

PHP Code:
$image='http://members.getaltitude.com/wp-content/uploads/2015/01/GETALTITUDE_black-300x64.png';
 if(@
getimagesize($image))
 {
 
$data file_get_contents($image);
 
force_download($file_name$data);
 }
 else
 {
 echo 
"The QR file does not exist!";
 } 

Here is the whole code:

PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class 
Download_qr extends CI_Controller {
 
 
 
public function force($qrcode)
 {
 
$this->load->helper('download');
 
$this->load->model('model_auth');
 
$query $this->db->get_where('url_tokens', array('short_url' => $qrcode));
 foreach (
$query->result() as $row)
 {
 
$product_id $row->product_id;
 
$product_type $row->product_type;
 if(
$product_type=='profile')
 {
 
$product_type_directory "profile";
 
$product_query 'card_details_id';
 }
 if(
$product_type=='campaign')
 {
 
$product_type_directory "campaigns";
 
$product_query 'campaign_details_id';
 }
 }
 
$data['item_details'] = $this->model_auth->$product_query($product_id$this->session->userdata['logged_data']['member_id']);
 if(
$product_type=='profile')
 {
 
$file_name $data['item_details'][0]->first_name."-".$data['item_details'][0]->last_name."-".$qrcode.".png";
 }
 if(
$product_type=='campaign')
 {
 
$file_name $data['item_details'][0]->name;
 } 
 if(
count($data['item_details'])>0)
 {
 
$image='http://members.getaltitude.com/wp-content/uploads/2015/01/GETALTITUDE_black-300x64.png';
 if(@
getimagesize($image))
 {
 
$data file_get_contents($image);
 
force_download($file_name$data);
 }
 else
 {
 echo 
"The QR file does not exist!";
 }
 }
 }


What am I doing wrong?
Reply
#2

Anyone?
Reply
#3

A blank page often indicates a PHP error which has been suppressed. This means you need to check your error logs and/or enable the error messages to determine where the error has occurred.

The best assumption I can make from your code is that file_get_contents() is throwing an error.
Reply
#4

force_download just set the headers to download a file, it doesn't output anything on the web page.
Reply
#5

Hi;

Errors, notices and all other warning types are. This is very strange. It used to pop up the browsers download panel (asking where to download to)!
Reply
#6

(02-15-2015, 11:43 PM)behnampmdg3 Wrote: Hi;

Errors, notices and all other warning types are. This is very strange. It used to pop up the browsers download panel (asking where to download to)!

The errors and warnings are there to tell why why it's not working ... don't ignore them.
Reply
#7

(02-16-2015, 01:59 AM)Narf Wrote:
(02-15-2015, 11:43 PM)behnampmdg3 Wrote: Hi;

Errors, notices and all other warning types are. This is very strange. It used to pop up the browsers download panel (asking where to download to)!

The errors and warnings are there to tell why why it's not working ... don't ignore them.
hey Narf;

It's a blank page. Shows nothing Sad
Reply
#8

(02-16-2015, 02:45 AM)behnampmdg3 Wrote: hey Narf;

It's a blank page. Shows nothing Sad

So where are those "errors, notices and all other warning" ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB