/ Published in: PHP
You can use this script in your projects when you need an image upload function. It checks file type, file size and error report. I also want you to check giochi di spongebob and gratis mahjong too. I hope you will like this code line.
Have a nice work.
Best wishes.
Expand |
Embed | Plain Text
<!-- Form Area --> <form enctype="multipart/form-data" action="uploader.php" method="post"> Select Image: <input type="file" name="userfile"> <input type="submit" value="Upload!"> </form> <!-- Form Area --> <?php # Variables $path = "images/"; $max_size = "200000"; # File $filename = $_POST['userfile']; # Control if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "The File is Too Big. The Max File Size is $max_size KB<br>n"; exit; } # Type Control if ( ($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/jpg") || ($HTTP_POST_FILES['userfile']['type']=="image/bmp") || ($HTTP_POST_FILES['userfile']['type']=="image/png") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") ) { # If File Exist { echo "A File With That Name Already Exists!<br>"; exit; } $HTTP_POST_FILES['userfile']['name']); if (!$res){ echo "Upload Failed!<br>"; exit; } else{ echo "Upload Sucessful!<br>"; } } else { echo "Wrong File Type<br>"; exit; } } ?>
You need to login to post a comment.
