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]
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 ) == 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;
}
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]
Comment