0

I want to stop user to upload of a file which is greater than 8mb (without uploading the whole file and then denying it). I put checks at browser and server levels but server level checks deny the upload after the image is uploaded. I want to stop the upload as soon as 8 mb is uploaded. Any ideas to implement it ?

I tried upload_max_filesize php.ini variable but it shows after the uploading completes.

  • 3
    possible duplicate of [javascript file upload size validation](http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation) – Tommaso Bertoni Mar 02 '15 at 14:38
  • PHP now has a real-time upload progress system, maybe you could look into that? – halfer Mar 02 '15 at 14:45
  • What have you tried so far? It would help potential answerers a lot if they could see some code. As it stands your question reads like a request for someone to do your work for you instead of you know... a question with an answer. – Aiken Mar 02 '15 at 14:48
  • @Aiken I calculate the size of file by using this statement $fsize=$file["size"]; if(fsize < 8*1024) {..upload successful} else{..throw error} , but the issue i am facing is this $fsize variable get value after the whole file is uploaded and i want to save that time of user . i put checks even at browser level but want to make system hack free even from curl call ,so looking for some alternative for this . – Devesh Batra Mar 02 '15 at 18:30
  • @DeveshBatra It's preferable to edit additional information into your question instead of posting it as a comment. – Aiken Mar 03 '15 at 07:56

0 Answers0