Cannot upload big files: "Undefined index: image_file"

Created:

2016-11-16 13:23:11 UTC

Modified:

2017-08-16 16:14:08 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Cannot upload big files: "Undefined index: image_file"

Applicable to:

  • Plesk 11.x for Windows

Symptoms

I cannot upload big files to my site using a custom .html script (http://%domain.tld%/upload.html). The following error appears:

Notice: Undefined index: image_file in %plesk_vhosts%\\%domain.tld%\\httpdocs\\upload.php on line 15
Notice: Undefined index: image_file in %plesk_vhosts%\\%domain.tld%\\httpdocs\\upload.php on line 16

Where %plesk_vhosts% is path to directory with virtual hosts (e.g., C:\Inetpub\vhosts).

Cause

  1. Exceeded PHP limits.
  2. Uploading files more than certain size is prohibited in the code of PHP script.

Resolution

  1. Increase PHP settings in the system php.ini file:

    upload_max_filesize 100M
    post_max_size 100M
    max_input_time 120
    max_execution_time 120

  2. PHP script may include string like follow. Review PHP code and increase limits for file size:
    if($file_size > 2097152){ 
    $errors[]='File size must be excately 2 MB';
    }
Have more questions? Submit a request
Please sign in to leave a comment.