0

I set the "upload_max_filesize=1024M" and "post_max_size=1024M" in php.ini.

I found a problem when I upload a big size file (2048M) via web browser.

The file was still uploading, while I can see the upload progress number and got PHP message in apache server log (/var/log/apache) immediately that like this:

"PHP Warning:  POST Content-Length of 2147483647 bytes exceeds the limit of 1073741824 bytes"

Finally the upload job would failed because the size of file is larger than the upload_max_filesize (2048M > 1024M)

How I can refuse the upload job as soon as possible while I deed know the size is larger than upload_max_filesize?

Ram Sharma
  • 8,676
  • 7
  • 43
  • 56
Yifan Wang
  • 504
  • 6
  • 13

1 Answers1

0

This can be done via HTML5.

<input type="file" id="myFile" />


var size = document.getElementById("myFile").files[0].size;
karmafunk
  • 1,453
  • 12
  • 20