Problem with php code.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem with php code.

    anybody here can add mime types force download in this code? for support download to mobile browser, content like mp3,java,sis,zip . i will pay u if u are from bangladesh.


    PHP Code:
     // 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" (YourSite.Com).$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 ) == )
                        {
                            
    $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;
                    }
                    
                    
    header"Pragma: public" );
                    
    header"Expires: 0" );
                    
    header"Content-Description: File Transfer");
                    
    header"Content-Type: application/octet-stream" );
                    
    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();
            }
        }[
    PHP
    [/PHP]

    #2
    something like this:

    PHP Code:
        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" (YourSite.Com).$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 ) == 
                        { 
                            
    $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(); 
            } 
        } 
    Last edited by something else; 08.11.13, 22:46.

    Comment


      #3
      Originally posted by something else View Post
      something like this:

      PHP Code:
          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" (YourSite.Com).$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 ) == 
                          { 
                              
      $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(); 
              } 
          } 
      thank you very very much brother.

      Comment


        #4
        Code:
        CHMOD Check/home/u448279428/public_html/install/ : [755] - >777
        /home/u448279428/public_html/sys/avatar/ : [755] - >777
        /home/u448279428/public_html/sys/dat/ : [755] - >777
        /home/u448279428/public_html/sys/forum/files : [755] - >777
        /home/u448279428/public_html/sys/gallery/48/ : [755] - >777
        /home/u448279428/public_html/sys/gallery/128/ : [755] - >777
        /home/u448279428/public_html/sys/gallery/640/ : [755] - >777
        /home/u448279428/public_html/sys/gallery/foto/ : [755] - >777
        /home/u448279428/public_html/sys/lib/stats/ : [755] - >777
        /home/u448279428/public_html/sys/license/ : [755] - >777
        /home/u448279428/public_html/sys/inc/ : [755] - >777
        /home/u448279428/public_html/sys/fnc/ : [755] - >777
        /home/u448279428/public_html/sys/loads/files/ : [755] - >777
        /home/u448279428/public_html/sys/loads/mp3crop/ : [755] - >777
        /home/u448279428/public_html/sys/loads/screens/14/ : [755] - >777
        /home/u448279428/public_html/sys/loads/screens/48/ : [755] - >777
        /home/u448279428/public_html/sys/loads/screens/128/ : [755] - >777
        /home/u448279428/public_html/sys/obmen/files/ : [755] - >777
        /home/u448279428/public_html/sys/obmen/screens/14/ : [755] - >777
        /home/u448279428/public_html/sys/obmen/screens/48/ : [755] - >777
        /home/u448279428/public_html/sys/obmen/screens/128/ : [755] - >777
        /home/u448279428/public_html/sys/update/ : [755] - >777
        /home/u448279428/public_html/sys/tmp/ : [755] - >777
        /home/u448279428/public_html/style/themes/ : [755] - >777
        Set the CHMOD 777 at /home/u448279428/public_html/install/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/avatar/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/dat/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/forum/files
        Set the CHMOD 777 at /home/u448279428/public_html/sys/gallery/48/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/gallery/128/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/gallery/640/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/gallery/foto/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/lib/stats/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/license/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/inc/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/fnc/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/loads/files/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/loads/mp3crop/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/loads/screens/14/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/loads/screens/48/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/loads/screens/128/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/obmen/files/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/obmen/screens/14/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/obmen/screens/48/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/obmen/screens/128/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/update/
        Set the CHMOD 777 at /home/u448279428/public_html/sys/tmp/
        Set the CHMOD 777 at /home/u448279428/public_html/style/themes/
        Script not ready to install
        what can i do now
        Last edited by arnage; 21.11.13, 18:34.

        Comment

        Working...
        X