5 Replies - 336 Views - Last Post: 06 February 2013 - 10:27 AM Rate Topic: -----

#1 david1842  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-February 13

problem i cant download bigger blob files in php

Posted 05 February 2013 - 12:38 PM

Hi!

How can i download files bigger than 50 MB, this is my code, when i try to download files > 50mb the process stoped...




ini_set("memory_limit","16384M");    
set_time_limit(0); 
require_once("connection_db.php");
$id_file=$_REQUEST['id_doc'];

$qry="Select file_name,size,type,file from file where id='$id_file'";
$res=mysql_query($qry) or die(mysql_error()." qry::$qry");
$obj=mysql_fetch_object($res);

//header
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-type: {$obj->type}");
header('Content-Disposition: attachment; filename="'.$obj->file_name.'"');
header("Content-Transfer-Encoding: binary");
print $obj->file;
		
//close the connection
mysql_close();






Is This A Good Question/Topic? 0
  • +

Replies To: problem i cant download bigger blob files in php

#2 laytonsdad  Icon User is online

  • Cheese and Sprinkles
  • member icon

Reputation: 432
  • View blog
  • Posts: 1,826
  • Joined: 30-April 10

Re: problem i cant download bigger blob files in php

Posted 05 February 2013 - 12:43 PM

where is it hosted? local or on a host?

Check the file limits on the server.
Was This Post Helpful? 0
  • +
  • -

#3 david1842  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-February 13

Re: problem i cant download bigger blob files in php

Posted 05 February 2013 - 03:22 PM

an a remote host,

are you talking about this??

upload_max_filesize 900M
max_file_uploads 50

Thank you
Was This Post Helpful? 0
  • +
  • -

#4 laytonsdad  Icon User is online

  • Cheese and Sprinkles
  • member icon

Reputation: 432
  • View blog
  • Posts: 1,826
  • Joined: 30-April 10

Re: problem i cant download bigger blob files in php

Posted 05 February 2013 - 05:11 PM

Are these files in the blob images?

Can you change it so that it is not saved in the database and save it to a directory and then save the url in the database? That is what I would do.

Also, you need to move away from mysql_* as they are degenerate. Look into mysqli_* here or PDOhere
Was This Post Helpful? 0
  • +
  • -

#5 david1842  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-February 13

Re: problem i cant download bigger blob files in php

Posted 05 February 2013 - 05:20 PM

Hi!!

I'm saving on a longblob filds and the file could be an .rar, .img, .dwg, etc, not only image,
and the another option culd be better than save all in a db with a longblob file... let me read the PDO, and once again thank you for you help.
Was This Post Helpful? 0
  • +
  • -

#6 david1842  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-February 13

Re: problem i cant download bigger blob files in php

Posted 06 February 2013 - 10:27 AM

Hi!

Here is my code and i could download a file >300MB usin PDO,

tahnk you laytonsdad

$id_doc=$_REQUEST['id_doc'];
		
		$host 	= "";
		$db	= "";
		$user	= "";
		$pass	= "";
		
		try 
			{
			   	$dbh = new PDO('mysql:host=localhost;dbname=db', $user, $pass);
			   	$sqlDownload = "Select name,size,type,file from file where id='".$id_doc."'"; 
				$result = $dbh->query($sqlDownload); 
				 
				$download = $result->fetchAll(); 
				 
				$type = $download[0]['type']; 
				$name = $download[0]['name']; 
				$content = $download[0]['file']; 
				 
				header("Content-type: $type"); 
				header("Content-Disposition: attachment; filename=$name"); 
		
				echo $content; 
				exit; 
			
			 
			} catch (PDOException $e) {
			   print "Error!: " . $e->getMessage() . "<br/>";
			   die();
			}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1