Tuesday, March 14, 2017

Call to a member function isValid() on null

I'm having problems with image uploading in Laravel 4. Whenever I try to submit form with the image I get error.

my view:

<div class='add_ad_feilds__upload'>
            <input class='add_ad_feilds__upload_file' type="file" name="img" accept="image/*"  />
            <img class='add_ad_feilds__upload_img' src="/front/img/icons/foto_blue.png" />
            <div class="add_ad_feilds__upload_text">
                <br />
                
            </div>
        </div>

Error: enter image description here

my ModelSnipet file:

public static function setImage ($file, $path = 'images', $image_type = false) { 
    if (!$file->isValid())
        return false;

    $path = 'upload/'.$path;

What can cause the problem? I have other submit forms they work well, but with this I got an error.



via Tracker7

Advertisement