2

I have a page with php code to upload user's picture for every account.Size of their image file must less than 100 kb size.

I want prevent uploading file more than 100 KB on server from users(in registering new user in image profile field) and during uploading(Not after uploading the entire file and just during uploading it), if the upload volume exceeds 100 KB, stop uploading progress and display warning for user by PHP(Preferred) OR any other script language for server-side code.

I searched by stackoverflow and google I didn't find any help or source about that.

Is any way to check size of uploaded data(not just size of a specific file) every second in a specific time from a client user by PHP OR Other server-side language (or server-side script)?

dartaplace
  • 33
  • 4
harix
  • 277
  • 3
  • 15
  • 1
    The PHP script isn't started until the file is fully uploaded. So it's not possible for it to check progress. – Barmar Jan 03 '18 at 21:34
  • You can do a scandir() and then loop over the array of files, then for every file you check with filesize() adding to a total number. Now you can not do this at a specific time interval, but as soon as someone comes online you can trigger the operation with a php script. – halojoy Jan 03 '18 at 21:37

0 Answers0