2
votes

I'm using Laravel 4.2 and I have some problems with uploading big files. If I upload small files all is working good.

I changed my php.ini and I stop/start the wamp server.

post_max_size = 128M

upload_max_filesize = 64M

on html file:

<form role="form" method="post" action="{{ URL::route('post-admin-cat-princ') }}" enctype="multipart/form-data">

        <div class="form-group">
            <label for="picture1">Catalogue</label>
            <input id="picture1" name="picture1" type="file" multiple class="form-control" />
            @if($errors->has('picture1'))
                {{ $errors->first('picture1') }}
            @endif
        </div>

        <input class="btn btn-success" type="submit" value="Add catalogue" />
    </form>

on routes:

Route::post('/catalogprinc', array('uses' => 'AdminController@postCatPrin', 'as' => 'post-admin-cat-princ'));

on controller:

public function postCatPrin() {
    if(Input::hasFile('picture1')) {
       save it;
       return Redirect::route('get-catalog')->with('success', 'Catalogue was added!');
    }
    return Redirect::route('get-catalog')->with('fail', 'There was no catalogue!');
}

The problem is that if the file is not big (image) it's working fine. If I try to add a pdf file (12MB) it fails and it will return the 'error' with There was no catalogue!

I have no idea what is wrong.

Thanks you!

EDIT: I am not using csrf.

1
What is your memory_limit in php.ini?Pᴇʜ

1 Answers

2
votes

In your php settings, make sure:

post_max_size=128M
upload_max_filesize=128M
memory_limit=128M

It doesn't have to be exactly 128M but just make sure its at least as big as the file you want to upload.