Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter Image Upload - can't get error message to show
    primarykey
    data
    text
    <p>This is my upload model</p> <pre><code> function upload_avatar() { $id = $this-&gt;tank_auth-&gt;get_user_id(); //config upload parameters and upload image $config = array( 'allowed_types' =&gt; 'jpeg|jpg|png', 'upload_path' =&gt; $this-&gt;upload_path, 'max_size' =&gt; 2048, 'encrypt_name' =&gt; TRUE, 'overwrite' =&gt; FALSE, ); $this-&gt;load-&gt;library('upload', $config); $this-&gt;upload-&gt;do_upload(); //get upload data, config, resize uploaded image, save in avatars subfolder $image_data = $this-&gt;upload-&gt;data(); if ($image_data['file_size'] &lt; 2048) { $config = array( 'source_image' =&gt; $image_data['full_path'], 'new_image' =&gt; $this-&gt;upload_path . '/avatars', 'maintain_ratio' =&gt; TRUE, 'width' =&gt; 125, 'height' =&gt; 125 ); $this-&gt;load-&gt;library('image_lib', $config); $this-&gt;image_lib-&gt;resize(); //only burn avatar path to user_profiles table if no upload errors if (!$this-&gt;upload-&gt;display_errors()) { $data = array('avatar' =&gt; base_url() . 'images/avatars/' . $image_data['file_name']); $this-&gt;db-&gt;where('id', $id); $this-&gt;db-&gt;update('user_profiles', $data); } //delete the original file from server $this-&gt;load-&gt;helper('file'); unlink($image_data['full_path']); } else { echo $this-&gt;upload-&gt;display_errors(); } } </code></pre> <p>I can't get the error message to echo straight to the browser when I try uploading a file > 2MB.</p> <p>To be fair, CI ignores this large file, and uploads correctly when a file is &lt; 2MB.</p> <p>The only thing is that I can't get the error message to show on the front-end to give the suer some feedback.</p> <p>Any ideas what's wrong here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload