use a leech filedownloader

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm about to make a backup php "program" that takes a backup with tar,
read's the output, send it with som headers so it's supposed to dowload,
and then it deletes the file, but it just doesent work with files that
is about 50MB, i hope one of you specialist's can help me.... 

JUST SO YOU KNOW, IT WORKS FINE WITH FILES ON ABOUT 4MB)

I tried ANY combination with the functions / headers that i commented
out...
-----------mainfile-------------------
<?php
require_once("functions.php");
//set_time_limit(0);
//ignore_user_abort(true);
session_cache_limiter("");
ob_start();
$filename .= "backup--";
$filename .= date("d-m-Y");
$filename .= "--{$_SESSION[username]}.tar.gz";
exec("tar cvzfp /backup/{$filename} {$_SESSION[myhomedir]}");
print(read_file("backup/{$filename}"));
//header("Cache-control: private");
//header("Content-Type: application/txt");
//header("Content-Disposition: attachment; filename={$filename}");
//Header("Content-type: text/plain");
//Header("Content-Disposition: attachment;
filename=topsellers_dvd.csv");
//header("Content-Disposition: inline;filename=test.tar.gz);

	header("Content-type: application/octet-stream");
	header("Content-Length: ".filesize("backup/{$filename}"));
if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) {
	header("Content-Disposition: attachment; filename={$filename}" .
"%20");
} else {
	header("Content-Disposition: attachment; filename={$filename}");
}

exec("rm /backup/{$filename}");
ob_end_flush();
?>
---------------------------------------------------------

----------functions.php----------------------------------
<?php

function read_file($file) {

	if (!($fp = fopen($file, 'r' ))) return false;
	$contents = fread($fp, filesize($file));
	fclose($fp);
	return $contents;
}

?>
---------------------------------------------------------

Regards
Lars Rasmussen.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux