I checked at least 10 answers, tried with DIR with constant, with basename etc... Same script is working like a charm in other file, but not in this one...
$target = __DIR__ . "/img/blog/" . $_FILES['slika']['name'];
//proveri da li postoji file za upload
if (move_uploaded_file($_FILES['slika']['tmp_name'], $target)) {
if (isset($_POST['published'])) {
$blog->_db->insert('ets_blog', array(
'kategorija' => $_POST['kategorija'],
'naslov' => $_POST['naslov'],
'tekst' => $_POST['text'],
'image' => $_FILES['slika']['name'],
'published' => 1
));
Anyway, when i move this IF before (move_uploaded_file) everything is working like a charm except it doesnt create a file, but it stores his name in database... when i echo target folder it's totaly okay. Any suggestions?