public function uploadImagens($dados, $where)
 {
     $this->_table = "f5_empresas";
     @mkdir("web-files/uploads/empresas/" . $dados[$this->idName]);
     $gerarUpload = new uploadHelper();
     $gerarUpload->carrega($dados[tmp_name])->redimensiona(100, 100, 'crop')->grava('web-files/uploads/empresas/' . $dados[$this->idName] . '/logotipo.jpg');
     return $this->update(array('logotipo' => 'logotipo.jpg'), $where);
 }
Example #2
0
			if(this == 0) return 0;
			
			var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'],
				e = Math.floor(Math.log(this) / Math.log(1024));

			return (this / Math.pow(1024, Math.floor(e))).toFixed(2) + " " + (units && units[e] ? units[e] : s[e]);
		}
</script>
</head>
<body>
 <?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    uploadHelper::checkToken() or die('Invalid Token');
    header('content-type: text/html;charset=utf-8');
    //if custom header => html5 file upload
    $u = new uploadHelper(TEMP_PATH, 'image');
    if (!($file = $u->upload_file())) {
        //upload failed, too large file ?
        ?>
<script type="text/javascript">
	var id = <?php 
        echo $f;
        ?>
,
		transfer = win.uploadManager.get(id);
	
	div = win.$(id + '_label').set('html', ' <span class="upload-error">upload failed (file too large ? Max size = <?php 
        echo ini_get('upload_max_filesize');
        ?>
)</span>...<a href="<?php 
        echo $self;
Example #3
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;
 public function uploadEditor($dados, $id)
 {
     $extensaoArquivo = substr($dados[name], -4);
     $nomeArquivo = md5(date('YmdHis')) . $extensaoArquivo;
     @mkdir('web-files/email-marketing/campanhas/' . $id . '/');
     $nomeImagem = 'web-files/email-marketing/campanhas/' . $id . '/' . $nomeArquivo;
     $gerarUpload = new uploadHelper();
     $gerarUpload->carrega($dados[tmp_name])->redimensiona(700, '', 'preenchimento')->grava($nomeImagem, 75);
     $array = array('filelink' => DIRETORIO_BASE . DIRETORIO_ADMIN . $nomeImagem);
     return json_encode($array);
 }
Example #5
0
             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);
                         }
                     }
                     unlink(TEMP_PATH . DS . $guid);
                 }
             }
         }
     }
 }
Example #6
0
; uploadManager.get(<?php 
    echo addslashes($f);
    ?>
).addEvent(\'onCancel\', function () {<?php 
    ?>
 $(id + \'_lfile\').value = \'\'; $(id).value = \'\'; $(id + \'_label\').innerHTML = \'\';  $(<?php 
    echo addslashes($f);
    ?>
 + \'_iframe\').src=$(id + \'_iframe\').src.replace(/&.*$/, \'\');<?php 
    ?>
$(id + \'_iframe\').setStyle(\'display\', \'block\');<?php 
    ?>
}).cancel(); <?php 
    ?>
return false">Cancel</a>';
					
				document.getElementById('iform').submit()
			}
		})
 }
 
</script>
<form name="iform" id="iform" action="" method="post" enctype="multipart/form-data">
<input id="file" type="file" name="image" size="20" class="inputbox" onchange="upload(this.value);" /><?php 
    echo uploadHelper::token();
    ?>
</form><?php 
}
?>
</body>
</html>
Example #7
0
/**
 * @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');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $filename = uploadHelper::create_filename(basename($headers['Filename']), TEMP_PATH);
    $path = uploadHelper::encrypt($filename);
    file_put_contents($filename, file_get_contents('php://input'));
    $size = filesize($filename);
    $self = basename($_SERVER['PHP_SELF']);
    header('Content-Type: application/x-json');
    echo json_encode(array('file' => basename($headers['Filename']), 'path' => $path, 'size' => $size, 'remove' => $self . '?r=' . urlencode($path)));
    if ($size == 0) {
        unlink($filename);
    }
    //remove file
} else {
    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);
            }
        }
    }
}
 public function uploadGaleria($dados, $where = null)
 {
     $this->_table = "f5_site_postagens_imagens";
     $this->idName = "id_postagem";
     @mkdir("../web-files/uploads/site/postagens/" . $dados[$this->idName]);
     @mkdir("../web-files/uploads/site/postagens/" . $dados[$this->idName] . "/galeria");
     $gerarUpload = new uploadHelper();
     $tratarUrl = new removerAcentosURLHelper();
     $gerarUpload->carrega($dados[tmp_name])->grava('../web-files/uploads/site/postagens/' . $dados[$this->idName] . '/galeria/' . $tratarUrl->tratar($dados[name], null, 'arquivo'));
     return $this->insert(array('id_postagem' => $dados[$this->idName], 'arquivo' => $tratarUrl->tratar($dados[name], null, 'arquivo')));
 }