示例#1
0
         //header("HTTP/1.1: 304 Not Modified Asset Not updated");
         //
         echo json_encode('The asset is locked, and was not updated');
         exit;
     }
     $path = $_FILES['file']['tmp_name'];
     if (!is_uploaded_file($path)) {
         //
         // HTTP errors don't work with ajaxupload - we send error 200 then a response != true
         //header("HTTP/1.1: 304 Not Modified Asset Not updated");
         //
         //echo "is_uploaded_file returned false. Possible break attempt";
         echo json_encode('The file upload failed, the asset was not updated');
         exit;
     }
     if (!assets::asset_upload(arg("id"), $path, arg("message"))) {
         //
         // HTTP errors don't work with ajaxupload - we send error 200 then a response != true
         //header("HTTP/1.1: 304 Not Modified Asset Not updated");
         //
         echo json_encode('The file upload failed, the asset was not updated');
         exit;
     }
     model::setKey(arg('id'), 'bytes', $_FILES['file']['size']);
     //
     // The result must be true for ajaxupload.js
     //
     echo json_encode(true);
     break;
 case "version_backup":
     $path = model::getKey(arg('id'), 'file');