예제 #1
0
<?php

/**
 * @package mycms
 * @copyright bela, http://tbela.net/
 *
 * cms upload handler, cross-browser ajax file upload
 * feel free to use and/or modify
 */
defined('_JEXEC') or die('Acces denied');
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date du passé
parse_str($_SERVER['QUERY_STRING'], $match);
if (is_file($file = uploadHelper::decrypt(array_shift(array_keys($match))))) {
    if (realpath($file) == TEMP_PATH . DS . basename($file)) {
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment;filename="' . uploadHelper::safe_name(uploadHelper::getVar('filename', basename($file))) . '"');
        header('Content-Length: ' . filesize($file));
        readfile($file);
        exit;
    }
}
header('HTTP/1.0 404 Not Found');
exit;
예제 #2
0
        ?>
'.shorten() + ' (' + (<?php 
        echo $filesize;
        ?>
).toFileSize() + ')');
	 
		transfer.fireEvent('success', arg).fireEvent('complete', transfer)
	}
	</script>
   <?php 
        exit;
    }
} else {
    //click on remove, remove the file
    if ($r = uploadHelper::get_param($_GET, 'r')) {
        $r = basename(uploadHelper::decrypt($r));
        if (is_file(TEMP_PATH . DS . basename($r)) && !in_array(basename($r), array($self, 'index.php')) && basename($r) != 'index.html') {
            chmod(TEMP_PATH . DS . basename($r), 0777);
            unlink(TEMP_PATH . DS . basename($r));
        }
    }
    ?>
<script type="text/javascript">
  
		function upload(file) {

			var uploadManager = win.uploadManager,
				id = <?php 
    echo $f;
    ?>
,
예제 #3
0
 if ($guid = uploadHelper::getVar('c')) {
     if (preg_match('/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/', $guid) && is_file(TEMP_PATH . DS . $guid)) {
         //remove chunks
         $infos = file(TEMP_PATH . DS . $guid);
         $infos[0] = trim($infos[0]);
         for ($i = 0; $i < $infos[1]; $i++) {
             if (is_file(TEMP_PATH . DS . $infos[0] . $i)) {
                 unlink(TEMP_PATH . DS . $infos[0] . $i);
             }
         }
         unlink(TEMP_PATH . DS . $guid);
     }
 } else {
     //remove file
     if ($file = uploadHelper::getVar('r')) {
         if (is_file($file = uploadHelper::decrypt($file))) {
             //$file = realpath($file);
             if (is_file(TEMP_PATH . DS . basename($file))) {
                 unlink($file);
             }
             //remove file
             if ($guid = uploadHelper::getVar('guid')) {
                 if (preg_match('/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/', $guid) && is_file(TEMP_PATH . DS . $guid)) {
                     //remove chunks
                     $infos = file(TEMP_PATH . DS . $guid);
                     $infos[0] = trim($infos[0]);
                     for ($i = 0; $i < $infos[1]; $i++) {
                         if (is_file(TEMP_PATH . DS . $infos[0] . $i)) {
                             unlink(TEMP_PATH . DS . $infos[0] . $i);
                         }
                     }