# Building .csv downloader

**URL:** <https://discourse.cakephp.org/t/building-csv-downloader/659>\
**Category:** Need Help\
**Created:** [July 1, 2016, 7:55am UTC](https://discourse.cakephp.org/t/building-csv-downloader/659 "2016-07-01T07:55:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PHPJunior](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@PHPJunior](https://discourse.cakephp.org/u/PHPJunior)\
**Post date:** [July 1, 2016, 7:55am UTC](https://discourse.cakephp.org/t/building-csv-downloader/659/1 "2016-07-01T07:55:02Z")

</div>

I am implementing the functionality for an admin to generate .csv files with all the data from the table Events in a certain period of time.

The problem is I’m still getting these errors:

`Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574] Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574]`

I am suspecting that this is the problem with my redirect line.

**`exportcsv` method in `EventsController`**

```
 public function exportcsv($beginning = null, $end = null)
{
 if ($this->request->is('post')) {
  $beginning = $this->request->data['Export']['beginning'];  
  $end = $this->request->data['Export']['end'];              

  return $this->redirect([$beginning, $end]); //I think that this line causes trouble
 }

 if (!$beginning && !$end) {
  return $this->render();
 }

 /* existing export action code *\
}

```

**`exportcsv.ctp` view:**

```
<div class="events form large-6 medium-4 columns content">
  <?= $this->Form->create('Export'); ?>
  <?= $this->Form->input('beginning', array('type'=>'datetime', 'interval' => 15, 'label' => 'Beginning:')); ?>
  <?= $this->Form->input('end', array('type'=>'datetime', 'interval' => 15, 'label' => 'End:')); ?>
  <?= $this->Form->button(__('Add')) ?>
  <?= $this->Form->end() ?>
</div>

```

I am new to CakePHP and I think that there is some minor error in my code that causes it. Can you help me fix the problem?

---

<div class="post-metadata">

**Author:** ![PHPJunior](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@PHPJunior](https://discourse.cakephp.org/u/PHPJunior)\
**Post date:** [July 2, 2016, 10:02am UTC](https://discourse.cakephp.org/t/building-csv-downloader/659/2 "2016-07-02T10:02:33Z")

</div>

I solved the problem with a simple transform both arrays into a string values.
