Jump to content

please help me brothers.


armanshuva5

Recommended Posts

where is the problem in this code? i can download my site content to pc but can't to mobile browser. here is my code please tell how i can fix this problem.

 

 

// DOWNLOADING FILE

   

    function download() 

    { 

        $result = $this->controllerObj->dbObj->getDInfo( $this->id ); 

         

        if ( ! empty( $result )) 

        { 

            if ( is_file( $result->path ) ) 

            { 

                $typeArray = array ( 'jpg' , 'gif' , 'jpeg' , 'png' ); 

                 

                $name = str_replace( ".$result->type" , " (Wapcon.tk).$result->type" , $result->name ); 

                 

                $this->controllerObj->dbObj->updateDtime( $this->id ); 

                 

                $type = strtolower( $result->type ); 

                 

                if ( in_array( $type , $typeArray )) 

                { 

                    $size = ( isset($_GET['size'] ) )? (int)$_GET['size'] : 1; 

                     

                    if ( $what = $this->controllerObj->resizeImage( $type , $result->path , $size ) == 1 ) 

                    { 

                        $size = filesize( './apanel/tmp/raw.jpg' ); 

                        $path = './apanel/tmp/raw.jpg';     

                    } 

                    else 

                    { 

                        $path = $result->path; 

                        $size = $result->size; 

                    } 

                } 

                else 

                { 

                    $size = $result->size; 

                    $path = $result->path; 

                } 

                

    $ext = array ( 

 

  // archives 

  'zip' => 'application/zip', 

  'tar' => 'application/x-tar', 

  'tgz' => 'application/x-compressed-tar', 

  'tar.gz' => 'application/x-compressed-tar', 

  'rar' => 'application/x-rar-compressed', 

  // documents 

  'pdf' => 'application/pdf', 

  'doc' => 'application/msword', 

  'xls' => 'application/vnd.ms-excel', 

  'ppt' => 'application/vnd.ms-powerpoint', 

   

  // executables 

  'exe' => 'application/octet-stream', 

 

  // images 

  'gif' => 'image/gif', 

  'png' => 'image/png', 

  'jpg' => 'image/jpeg', 

  'jpeg' => 'image/jpeg', 

 

  // audio 

  'mp3' => 'audio/mpeg', 

  'wav' => 'audio/x-wav', 

 

  // video 

  'mpeg' => 'video/mpeg', 

  'mpg' => 'video/mpeg', 

  'mpe' => 'video/mpeg', 

  'mp4' => 'video/mp4', 

  'mov' => 'video/quicktime', 

  'avi' => 'video/x-msvideo', 

  'wmv' => 'video/x-ms-wmv', 

  'mov' => 'video/quicktime', 

 

  // mobile 

  'sis' => 'application/vnd.sybian.install', 

  'jar' => 'application/java-archive', 

  '3gp' => 'application/octet-stream', 

  'nth' => 'application/vnd.nok-s40theme', 

  'thm' => 'application/vnd.eri.thm', 

  'amr' => 'audio/amr', 

  'sisx' => 'application/octet-stream', 

  'mid' => 'audio/midi', 

  'swf' => 'application/x-shockwave-flash', 

  'jad' => 'text/vnd.sun.j2me.app-descriptor' 

 

    );  

 

                 

                header( "Pragma: public" ); 

                header( "Expires: 0" ); 

                header( "Content-Description: File Transfer"); 

                header( "Content-Type: ".$ext[$type]); 

                header( "Cache-Control: must-revalidate post-check = 0 pre-check = 0" ); 

                header( "Cache-Control: public" ); 

                header( "Content-Length: $size" ); 

                header( "Content-Disposition: attactment; filename=\"$name\"" ); 

                header( "Content-Transfer-Encoding: binary/n" ); 

                 

                readfile( $path ); 

                 

                exit(); 

            } 

            else 

            { 

                $this->index(); 

            } 

        } 

        else 

        { 

            $this->index(); 

        } 

    } 

Link to comment
https://forums.phpfreaks.com/topic/283744-please-help-me-brothers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.