Dakle ako na serveru imam pera.jpg , i pokusam da uploadujem pera.jpg drugu neku sliku, on ce prvu da prebrise i ostavi drugu. Meni treba da npr. drugoj promeni ime u pera032324.jpg pa onda da uploaduje. Ubacicu mu ja random, samo molim objasnjenje gde i kako, kojom naredbom
ovo je kod
Code:
function uploadFile(){
if (!isset($_POST['submitBtn'])){
$this->showUploadForm();
} else {
$msg = '';
$error = '';
//Check destination directory
if (!file_exists($this->uploadLocation)){
$error = "The target directory doesn't exists!";
} else if (!is_writeable($this->uploadLocation)) {
$error = "The target directory is not writeable!";
} else {
$target_path = "../../slike_proizvoda/" . basename( $_FILES['myfile']['name']);
if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
$msg = basename( $_FILES['myfile']['name']).
" was uploaded successfully!";
$slika= basename( $_FILES['myfile']['name']);
echo "$slika";
} else{
$error = "The upload process failed!";
}
}
$this->showUploadForm($msg,$error);
}
}
}
function uploadFile(){
if (!isset($_POST['submitBtn'])){
$this->showUploadForm();
} else {
$msg = '';
$error = '';
//Check destination directory
if (!file_exists($this->uploadLocation)){
$error = "The target directory doesn't exists!";
} else if (!is_writeable($this->uploadLocation)) {
$error = "The target directory is not writeable!";
} else {
$target_path = "../../slike_proizvoda/" . basename( $_FILES['myfile']['name']);
if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
$msg = basename( $_FILES['myfile']['name']).
" was uploaded successfully!";
$slika= basename( $_FILES['myfile']['name']);
echo "$slika";
} else{
$error = "The upload process failed!";
}
}
$this->showUploadForm($msg,$error);
}
}
}