0

I've following HTML code to upload image file :

<form id="request_form" method="post" enctype="multipart/form-data" action="print.php">
  <input type="file" name="student_image" id="student_image" accept="image/*" capture/>                  
  <button type="submit">Submit</button>
</form>

PHP code is as follows :

<?php
print_r($_FILES);// Here I'm getting blank $_FILES array for few specific image files which are greater than 10 MB in size
?>

Following are the file upload setting from my php.ini file:

upload_max_filesize = 10M

post_max_size = 10M

I'm getting the blank array when I try to upload image files which are greater than 10 MB in size.

Please help me out from this issue.

Anand Solanki
  • 3,419
  • 4
  • 16
  • 27
PHPLover
  • 1
  • 51
  • 158
  • 311
  • 1
    **A:** Increase the settings. – Funk Forty Niner Dec 10 '14 at 13:09
  • Isn't he should get errors about this? – vaso123 Dec 10 '14 at 13:10
  • @lolka_bolka *"I'm getting the blank array when I try to upload image files which are greater than 10 MB in size."* - Look at OP's present settings in `.ini` file. – Funk Forty Niner Dec 10 '14 at 13:11
  • @A:I'm getting this issue while validating the uploaded file size. As I'm getting the blank array the validation condition for image has not been uploaded is echoing. Actually I want to echo the error message as the file size is exceeding the size limit which I can't. – PHPLover Dec 10 '14 at 13:11
  • 1
    @user2839497 It's up to you then to place a limit in your PHP and show the user an error if greater than 10M. What is the "real" question? – Funk Forty Niner Dec 10 '14 at 13:12
  • @Fred-ii-:I want the value from $_FILES['student_image']['size']. If I get this value then I can validate and echo the error message as "Size is more than specified". But the real problem is I'm not getting value in $_FILES['student_image']['size']. – PHPLover Dec 10 '14 at 13:14
  • In short I want to echo error message if the uploaded image file size exceeds the maximum size limit. – PHPLover Dec 10 '14 at 13:16
  • See this Q&A's http://stackoverflow.com/q/18567861/ - particularly the accepted answer http://stackoverflow.com/a/18568104/ – Funk Forty Niner Dec 10 '14 at 13:18

1 Answers1

0

You need to change your php.ini file and set greater value than 10M, it is config for Apache, and Apache doesn't let you to send big image and files before it

Hayk Aramyan
  • 223
  • 3
  • 14