Like when you download a file to the server to do UTF8?

0 like 0 dislike
4 views
Hello, upload the file so
<?if(isset($_FILES['avatar'])){$formats = array("jpeg","jpg","gif","png");$format = @end(explode(".",$_FILES['avatar']['name']));if($_FILES['avatar']['size'] < 2097152) {if(in_array($format,$formats)){if(is_uploaded_file($_FILES['avatar']['tmp_name'])){$dir = "resource/img/avatars/".$_FILES['avatar']['name'];if(move_uploaded_file($_FILES['avatar']['tmp_name'], $dir)){echo '<div class="inform">Super!  Now you have a new avatar.'; mysqli_query($link,"UPDATE `users` SET `avatar`= '/$dir' WHERE id=$server"); } }else{echo 'Error!  Make sure that the picture format (png,jpg,jpeg,png).';} }else{mysqli_query($link,"UPDATE `users` SET `avatar`= "WHERE id=$server");echo 'Error!  You have not provided a picture so she folded.';} }else{ echo 'Error!  Make sure that the picture does not more 2MB.'; } } ?>

and if the file is written in Russian, it is maintained that this form of R RR· RR°R·RIR°Rres
In Russian it (Without a title.png)
I would be grateful for help.

If not difficult help to make so that the picture "jpeg","jpg","gif","png" which is 400px when the download has shrunk to 150px
=)
by | 4 views

2 Answers

0 like 0 dislike
Try to change the encoding of the php file and insert the following tags: html head body
and the head of e insert
by
0 like 0 dislike
Use PDO
Do not use error suppression (@)
Add the MIME sniffing file upload
Review fkn.ktu10.com/?q=node/7015
Try to separate at least the formation of the html from the logic

And the solution to your problem:
Do not use the original file name. Generate random of sufficient length or shape it in a different way. In addition to encoding problems and problem characters who can be in the file name, you must also make sure that the file names in one directory don't match.

To manipulate the image, resizing, and so use a specialized library and a good option: image.intervention.io
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,911 users