<?php
session_start();
if(isset($_SESSION['_DOMAIN_ID'])){
/**
* upload.php
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
#!! IMPORTANT:
#!! this file is just an example, it doesn't incorporate any security checks and
#!! is not recommended to be used in production environment as it is. Be sure to
#!! revise it and customize to your needs.
// Make sure file is not cached (as it happens for example on iOS devices)
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
/*
// Support CORS
header("Access-Control-Allow-Origin: *");
// other CORS headers if any...
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit; // finish preflight CORS requests here
}
*/
// 5 minutes execution time
@set_time_limit(5 * 60);
// Uncomment this one to fake upload time
// usleep(5000);
// Settings
$ftraget = addslashes($_GET['target']);
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
$targetDir = '../sites/'.$_SESSION['_DOMAIN_ID'].'/files/u/'.$ftraget;
if($_SESSION['_DOMAIN_ID']==0) {
exit;
}
if(is_dir($targetDir)){
$file_name = $targetDir.'/'.addslashes($_GET['file']).'.'.addslashes($_GET['dot']);
if(file_exists($file_name)){
if(unlink($file_name)){
echo '0'; // file has been deleted
}else{
echo '1'; // couldn't delete file
}
}else{
echo '2'; // no file in directory
}
}else{
echo '3'; // no directiory
}
}else{
echo '4'; // no session
}