Ben bir php sayfası tarafından çıkışı bir Android APK dosyasını indirmek için çalışıyorum. Ben şu var ve bu firefox üzerinde değil telefon üzerinde çalışıyor.
Firefox apk uzantılı indirmeler ama yanındaki küçük bir firefox simgesi vardır.
Telefon bir. Html uzantılı dosyayı indirir, neden bu?
GÜNCELLEME: Tam kaynak
function display($tpl = null) {
//SETUP
$appId = JRequest::getInt('id', '0');
$model = &$this->getModel();
$app = $model->getApplication($appId);
if( !$app )
JError::raiseError(500, "Invalid Application ID");
if( empty($app->apk_file) )
JError::raiseError(500, "No APK file found in the database");
$result = $model->newDownload($appId);
//Update the database
if( !$result )
JError::raiseError(500, "Unable to increment download count for ID:".$appId);
//Return the file
$filesFolder = JPATH_COMPONENT_ADMINISTRATOR .DS. 'uploads' .DS. $appId;
//Output the file contents
$sanitizedFolder = JFolder::makeSafe($filesFolder);
$sanitizedFile = JFile::makeSafe($app->apk_file);
$path = $sanitizedFolder .DS. $sanitizedFile;
if( !JFile::exists($path) ) {
JError::raiseError(500, 'File does not exist');
}
else {
header('Content-type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename="'.$sanitizedFile.'"');
readfile($path);
}
}
My setup:
Fedora Core 10
PHP 5.2.9
Apache