Import CSV Action

Hello guys,

I worked on an controller action to import a simple CSV-file.

This is my CSV;test1;test2;test3;test1;test2;test3

… and this is my Action. The result is an Error 500 :frowning:

* @param array $csv
* @return void
public function importcsvAction(array $csv) {

    /* @var $fileResource \TYPO3\Flow\Resource\Resource */
    $fileResource = $this->resourceManager->importUploadedResource($csv);
    $uri = $fileResource->getUri();

    $recipientList = file($uri);
    foreach ($recipientList as $recipient) {
        list($email, $firstname, $lastname, $gender) = explode(';', $recipient);
        $user = new \DirectMail\Newsletter\Domain\Model\Recipient();

If you have an error 500 on your server, I’m pretty sure the hint towards the reason for the error is within your error log. Did you see something there? If so, what does it say at the time it throws an error 500 to you?

Looks like you where working on something similar like myself for the Lelesys Newsletter Plugin?

I have created a fork for our website here with CSV Import.

the main actions are in the PersonController

i just didn’t made it a file upload but instead a simple textarea.

1 Like

Very good idea, thank you! :slight_smile:

you can just use the repository or fork it yourself. If you have any pull request you can create one too of course. Will be happy to merge something. Maybe it can even go back into the main repository later too.