0

I have this piece of code in my BaseModel inside the validate method:

foreach(Input::file() as $key => $value)
{
    (!empty($value)) ? $this->attributes[$key] = Input::file($key) : $this->attributes[$key] = '';
}

This allows me to integrate file validation with the rest of the input validation. Using the rules required and mimes:png it works as it should.

However, for ajax requests I always receive $this->attributes[$key] = ''.

Is there any catch when uploading files via ajax in Laravel 4?

user2094178
  • 9,204
  • 10
  • 41
  • 70

1 Answers1

0

Assuming it's your upload script, not Laravel. You can't simply send files over the usual ajax request. How to see the Files uploaded in a form with ajax?

Community
  • 1
  • 1
Nathan Loding
  • 3,185
  • 2
  • 37
  • 43