I have a upload image function on my web app, I tried to upload a php
file with a code like this <script>alert('XSS')</script>
the file is hack.php.jpg
then, I upload it and it is uploaded, my fear of this is that, will the script
will run and return something to the malicious user or it will ignore the script
inside of the .jpg
? Here are the list of function of my upload image:
1) It will rename the image then will be saved on the folder.
2) only accepted extensions
are jpg, png, jpeg
.
3) file size < 1000000
.
4) uniqid()
used for renaming the name of the img
.
5) I use unlink()
and move_upload_file()
for saving the img
and deleting the img
on the folder.
6) my <form> enctype
is multipart/form-data
and accept="image/*"
.
I learned my code in codecourse php upload file
video.