Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST["update"])) {
- $file = $_FILES["file"];
- $fileName = $file["name"];
- $fileTMP = $file["tmp_name"];
- $fileSize = $file["size"];
- $fileType = $file["type"];
- $fileError = $file["error"];
- $fileExp = explode(".", $fileName);
- $fileExpAct = strtolower(end($fileExp));
- $allowed = array("jpg","jpeg","png","gif");
- if (in_array($fileExpAct,$allowed)) {
- if ($fileError === 0) {
- if ($fileSize < 10000000) {
- $fileNewName = uniqid("",true).".".$fileExpAct;
- $destination = "upload/".$fileNewName;
- move_uploaded_file($fileTMP, $destination);
- header("Location: index.php?success");
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement