Hello.
I created a php script to upload my images to a directory.
My objective is to get the file name and create a folder with this name, than upload all the current files into this folder.
The script is this one:
<?php
include('../fbx_Settings.php');
$link = mysql_connect("$DBServer","$DBUser", "$DBPass");
mysql_select_db("$DSN");
if ($_FILES) {
$tmp_name = $_FILES["pictures"]["tmp_name"];
$name = $_FILES["pictures"]["name"];
$path = "upimage";
$tirar = explode(".",$name);
mkdir ($path ."/". $tirar[0], 0777);
$local = $tirar[0];
$path_d = "upimage/". $local ."/";
move_uploaded_file($tmp_name,$path_d);
$fotoNome = $_FILES["pictures"]["name"];
$fotoSize = $_FILES["pictures"]["size"];
$pega_id = mysql_query("SELECT * FROM scm_galerias ORDER BY dtInserted DESC LIMIT 1",$link);
$fetch = mysql_fetch_array($pega_id);
$id = $fetch['fotoId'] + 1;
$fotoPath = "admin/b_usados/upimage/";
$sql = mysql_query("INSERT INTO scm_galerias(fotoNome, fotoSize, fotoId, fotoPath, dtInserted) values ('$fotoNome','$fotoSize','$id','$fotoPath', SYSDATE())",$link) or die("morreu");
echo "Sucesso";
} else {
echo "Erro!";
}
?>
But it returns an error at line 13, the line 13 is:
move_uploaded_file($tmp_name,$path_d);
I don't have any other idea about it.
Thanks for the help!