ok
Direktori : /home/viveiroimperium/www/admin/ |
Current File : /home/viveiroimperium/www/admin/upload.php |
<?php header("Content-Type: text/html; charset=iso-8859-1");?> <?php include("../class/class.db.php"); ?> <?php include("../class/class.seguranca.php"); ?> <?php $db = new DB(); // A list of permitted file extensions $allowed = array('png', 'jpg', 'gif'); if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){ //$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION); //if(!in_array(strtolower($extension), $allowed)){ //echo '{"status":"error"}'; //exit; //} $novo_nome=$_FILES['upl']['name']; if(move_uploaded_file($_FILES['upl']['tmp_name'], '../imagens/'.$novo_nome)){ $sel = $db->select("INSERT INTO fotos_maquinas (id_maquina, foto_maquina) VALUES ('$id', '$novo_nome')"); echo '{"status":"success"}'; exit; } } echo '{"status":"error"}'; exit;