Solarpitch Posted December 31, 2006 Share Posted December 31, 2006 Hey Guys, I have the following code that stores the path of an image in the database.[code]$uploaddir = "./user_images./";$uploadfile = $uploaddir . basename($_FILES['userfile1']['name']);$filePath = $uploadfile;//$filename = $uploaddir . basename($_FILES['me']);echo '<pre>';if (move_uploaded_file($_FILES['userfile1']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n";} else { echo "Possible file upload attack!\n";}echo 'Here is some more debugging info:';print_r($_FILES);print "</pre>";[/code]What can/ or how can I add upload restrictions to this code. ie: max upload file size, type of file(only allow jpg/gif) etc.. Link to comment https://forums.phpfreaks.com/topic/32390-coding-restrictions-on-uploaded-user-images/ Share on other sites More sharing options...
alpine Posted December 31, 2006 Share Posted December 31, 2006 You will find some examples at http://www.w3schools.com/php/php_file_upload.asp Link to comment https://forums.phpfreaks.com/topic/32390-coding-restrictions-on-uploaded-user-images/#findComment-150419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.