lundi 2 mai 2016

Peculiar issues with uploading a file from a form Laravel 4.2

In the future I plan on using this file to update a DB, but right now I am just trying to get the file to upload to my server.

The folder in question is chmod 777, so it should be able to accept this upload. What happens is when I submit the upload, I get an ERR_TOO_MANY_REDIRECTS error. There are no errors in laravel.log.

My HTML:



      <br>
      
      



My controller:

class ImportController extends BaseController {
public function import()
$csv = Input::file('csv');
$destinationPath = public_path() . '/import';
$fileName = 'import' . now() . '.' . 'csv';
$csv->move($destinationPath, $fileName);

Redirect::to('/')->withMessage("Success");
}

My routes (for good measure):

Route::post('/import', 'ImportController@import');
Route::get('/import', 'ImportController@index');

I have used similar code to upload in the past with no issues... is there something going on here?

Aucun commentaire:

Enregistrer un commentaire