Problem uploading file with Laravel Excel

Posted 3 years ago by steveperrycreative

I'm trying to upload a file and add the contents to my database using Laravel Excel. The file is uploaded using a form which posts to my uploadFromCsv method.

When I upload the file I get:

PHPExcel_Reader_Exception in Excel2007.php line 82: Could not open for reading! File does not exist.

My form is:

<form class="form-horizontal" method="POST" action="/ascents/upload">
    {!! csrf_field() !!}
    <div class="form-group">
        <label for="file" class="col-sm-3 control-label">Select CSV File</label>
        <div class="col-sm-9">
            <input type="file" class="form-control" id="file" name="file">
    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-9">
            <button type="submit" class="btn btn-default">Upload</button>

And my method is:

public function uploadFromCsv()
    Excel::load(Input::file('file'), function ($reader) {
        foreach ($reader as $log) {
            $ascent = new Ascent($log->all());
    return redirect(route('ascents'));

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.