Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $imageinfo = getimagesize($_FILES['userfile']['tmp_name']);
- if($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg') {
- echo "Sorry, we only accept GIF and JPEG images\n";
- exit;
- }
- $uploaddir = 'uploads/';
- $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
- if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
- echo "File is valid, and was successfully uploaded.\n";
- } else {
- echo "File uploading failed.\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement