vikaspa Posted November 30, 2008 Share Posted November 30, 2008 DEar All I want to restrict user to upload image files before upload is this possible using java script / PHP ? Example : if user tries to upload a file of size more than 300KB he should be warned Please help Please Help Quote Link to comment https://forums.phpfreaks.com/topic/134816-get-image-size-in-k-kb-or-mb/ Share on other sites More sharing options...
timmah1 Posted November 30, 2008 Share Posted November 30, 2008 http://us.php.net/features.file-upload <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="__URL__" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/134816-get-image-size-in-k-kb-or-mb/#findComment-702041 Share on other sites More sharing options...
.josh Posted November 30, 2008 Share Posted November 30, 2008 forms are easily spoofed. Be sure to check it server side with $_FILES['userfile']['size'] Quote Link to comment https://forums.phpfreaks.com/topic/134816-get-image-size-in-k-kb-or-mb/#findComment-702042 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.