/var/www/vhosts/sivana.com.br/httpdocs/admin/upload-noticias.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include("../_private/conectar.php");
$ds          DIRECTORY_SEPARATOR;  //1
$id_cont$_POST['id_cont']; 
$storeFolder '../userfiles/image';   //2
 
if (!empty($_FILES)) {
     
    
     
    
$tempFile $_FILES['file']['tmp_name'];          //3             
      
    
$targetPath dirname__FILE__ ) . $ds$storeFolder $ds;  //4
     
    
$targetFile =  $targetPath$_FILES['file']['name'];  //5
 
    
move_uploaded_file($tempFile,$targetFile); //6
    
     
$query mysql_query("INSERT INTO foto_noticia VALUES('','$id_cont','".$_FILES['file']['name']."')") or die ("erro ao selecionar a tabela");
     
}
?>