Search code examples
phplaravelfile-uploadlaravel-4.2

$file->isValid() returns false in laravel 4.2


$file = Input::file('video');
dd($file,$file->isValid());

enctype="multipart/form-data" is set in the form.

max_upload_limit is also increased and apache restarted

$file has the file, but $file->isValid() is always returning false.


Solution

  • Open the php.ini file. Find these lines in the php.ini file and replace it following numbers

    upload_max_filesize = 64M
    

    Save the changes and refresh your website and try uploading the file again.


    Retrieving An Uploaded File

    $file = Input::file('photo');
    

    Determining If An Uploaded File Is Valid

    if (Input::file('photo')->isValid())
    {
        //
    }