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();
}
}