Example #1
0
     //chmod($apk_path, 0777);
     if (move_uploaded_file($apk_tmp_file, $apk_path)) {
         $application->apk_path = $apk_final . ".apk";
     } else {
         echo "an error occured while trying to upload.";
         //header('Location: error.php');
     }
 } else {
     $application->apk_path = $_POST['old_apk'];
 }
 if ($application->update()) {
     echo "updated";
 } else {
     echo "not updated";
 }
 $dis_app = Application::find_by_sql("SELECT * FROM `applications` WHERE `app_name`='{$apptitle}'");
 //screenshots
 if (isset($_FILES['shot'])) {
     $shots = $_FILES['shot'];
     $scr_target_dir = "../screenshots";
     $i = 1;
     foreach ($shots['error'] as $key => $error) {
         if ($error == UPLOAD_ERR_OK) {
             $tmp_name = $_FILES["shot"]["tmp_name"][$key];
             $name = basename($_FILES["shot"]["name"][$key]);
             $scr_id = $_POST['scr_id'][$i - 1];
             $ext = strrchr($name, ".");
             $dest_name = str_replace(" ", "", $apptitle) . "_" . $i . $ext;
             $i++;
             $destination = $scr_target_dir . "/" . $dest_name;
             chmod($tmp_name, 0777);