savez
1/25/2017 - 4:19 PM

download file da PHP

download file da PHP

	$fullPath = '<path>';
	if ($fd = fopen ($fullPath, "r")) {
		$fsize = filesize($fullPath);
		$path_parts = pathinfo($fullPath);
		header("Content-type: application/pdf");
		header("Content-Disposition: attachment; filename=\"document.pdf\"");
		header("Content-length: $fsize");
		header("Cache-control: private");
		while(!feof($fd)) {
			$buffer = fread($fd, 2048);
			echo $buffer;
		}
	}
	fclose ($fd);