Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($_POST['uploadImage']) {
- if (
- (
- ($_FILES["fileName"]["type"] == "image/gif") ||
- ($_FILES["fileName"]["type"] == "image/jpeg") ||
- ($_FILES["fileName"]["type"] == "image/png") ||
- ($_FILES["fileName"]["type"] == "image/pjpeg")
- ) && ($_FILES["fileName"]["size"] < 2000000)
- ) {
- $directory = 'upload' . DIRECTORY_SEPARATOR . $_SESSION['_userID'] . DIRECTORY_SEPARATOR;
- $fileName = md5(time() . '_' . $_FILES["fileName"]["name"]);
- $extension = str_replace('image/', '', $_FILES["fileName"]["type"]);
- $fPath = $directory . $fileName . '.' . $extension;
- move_uploaded_file($_FILES['fileName']['tmp_name'], $fPath);
- $_SESSION['_success'] .= 'Успешно качихте файл.';
- header("Location: index.php");
- exit();
- } else {
- $_SESSION['_error'] .= 'Невалидна снимка';
- header("Location: index.php");
- exit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment