I want to download file class support resume

Discussion in 'PHP' started by ahmed_badawy, Apr 6, 2009.

  1. #1
    hi every one

    i have download file class but not support resume and i need must supporting resume

    class code

    
    <?
    /*
     * Class has simple interface to download any file from a server
     * without displaying the location of the file
     *
     * Author: Viatcheslav Ivanov, E-Witness Inc., Canada;
     * mail: ivanov@e-witness.ca;
     * web: www.e-witness.ca; www.coolwater.ca; www.strongpost.net;
     * version: 1.1 /08.19.2002
     *
     */
    
    if ( !defined("DOWNLOADFILE_H") ) {
    
    	define("DOWNLOADFILE_H",1);
    
    	class DOWNLOADFILE {
    		var $df_path = "";
    		var $df_contenttype = "";
    		var $df_contentdisposition = "";
    		var $df_filename = "";
    
    		function DOWNLOADFILE($df_path, $df_contenttype = "application/octet-stream", $df_contentdisposition = "attachment", $df_filename = "") {
    			$this->df_path = $df_path;
    			$this->df_contenttype = $df_contenttype;
    			$this->df_contentdisposition = $df_contentdisposition;
    			$this->df_filename = ($df_filename)? $df_filename : basename($df_path);
    		}
    
    		// check is specified file exists?
    		function df_exists() {
    			if(file_exists($this->df_path)) return true;
    			return false;
    		}
    
    		// get file size
    		function df_size() {
    			if($this->df_exists()) return filesize($this->df_path);
    			return false;
    		}
    
    		// return permission number for user 'other'
    		function df_permitother() {
    			return substr(decoct(fileperms($this->df_path)),-1);
    		}
    
    		// download file
    		function df_download() {
    			if($this->df_exists() && $this->df_permitother() >= 4) {
    				header("Content-type: ".$this->df_contenttype);
    				header("Content-Disposition: ".$this->df_contentdisposition."; filename=\"".$this->df_filename."\"");
    				header("Content-Length: ".$this->df_size());
    
    				$fp = readfile($this->df_path, "r");
    				return $fp;
    			}
    			return false;
    		}
    
    	}
    
    } //if ( !defined("DOWNLOADFILE_H") )
    
    ?>
    
    PHP:
    thanx
     
    ahmed_badawy, Apr 6, 2009 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
  3. ahmed_badawy

    ahmed_badawy Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you, but after the attempts does not work

    
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 57
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 58
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 59
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 76
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 82
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 96
    
    Warning: Cannot modify header information - headers already sent by (output started at /www/dwon/dwon.php:1) in /www/dwon/dwon.php on line 97
    
    PHP:
     
    ahmed_badawy, Apr 6, 2009 IP
  4. ahmed_badawy

    ahmed_badawy Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    any one can help
     
    ahmed_badawy, Apr 6, 2009 IP