Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_FILES["char"])){
- if($_FILES["char"]["name"] != ""){
- $char = $_FILES["char"]["name"];
- $extension = strtolower(getExtension($char));
- if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")){
- $blnErrors = true;
- $errors[] = "Your character screenshot is not a picture file.";
- }else{
- $size = filesize($_FILES['char']['tmp_name']);
- $max_upload = (int)(ini_get('upload_max_filesize'));
- $max_post = (int)(ini_get('post_max_size'));
- $memory_limit = (int)(ini_get('memory_limit'));
- $upload_mb = min($max_upload, $max_post, $memory_limit) * 1024 * 1024;
- if($size > $upload_mb || $size == null){
- $blnErrors = true;
- $errors[] = "The screenshot you are trying to upload is too big.";
- }else{
- $copied = copy($_FILES['char']['tmp_name'], "assets/screenshots/character/".$userinfo["username"].".".$extension);
- if (!$copied){
- $blnErrors = true;
- $errors[] = "Something went wrong while uploading your screenshot. Please try again.";
- }else{
- $userinfo["char_url"] = "assets/screenshots/character/".$userinfo["username"].".".$extension;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment