security - How to unlink file securly in php? -
i need delete image files in /var/www/mysite/postimage
folder unlink()
function in php. i'm absolutely worried if hacked site , using .. or . in path , try delete in upper level folder. i'm using jquery send path , because it's client side programming it's dangerous. know , can bypass dots when uploading files if changes path in client side adding dots it? question how prevent doing that?
- make sure apache user has proper rights(writing in website directory)
- cut
..
path, sanitize , validate path if it's correct. - you can use realpath() function.
Comments
Post a Comment