Skip to content

FileName cannot be empty #47

Open
Open

Description

@bastoune

Hi,

When I upload some csv file, I get the error SplFileObject::__construct():Filename cannot be empty in Lexer.php line 50.
when I echo $file->getClientOriginalName(), it give me the right name which is just "liste.csv".
In the headers sended, I do have
Content-Disposition: form-data; name="file"; filename="liste.csv"
Content-Type: application/vnd.ms-excel

here is my code

    $file = Input::file('file');
                //echo $file->getClientOriginalName();
    $config = new LexerConfig();
    $config
                    ->setDelimiter(";")
                    ->setToCharset('UTF-8')
    ;
    $lexer = new Lexer($config);
    $interpreter = new Interpreter();

    $salarie_csv = [];
    $errors = [];
    $lineNb = 0;
    $interpreter->addObserver(function (array $rows) use (&$salarie_csv, &$lineNb, &$errors) {
        //some code
    });
    $lexer->parse($file, $interpreter);

    return Response::json($errors, 200);

Activity

  1. bastoune commented on Nov 24, 2014

    @bastoune
    Author

    When I limit the number of line to 20.000 it works well, the file is initially 2.5Mb size.
    Is there a row number limit/ file size limit ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions