使用Laravel 4迭代多个请求文件

Is there a way to iterate through the Request File objects in Laravel 4? I'd like to do something like this:

foreach (Input::files() as $file) {
  $filename = str_random(8) . '-' . $file->getClientOriginalName();
  $uploadSuccess = $file->move($destinationPath, $filename);
  // ...
}

I'd like to use the Input:: approach instead of iterating the $_FILES array.. Thanks

Going into Symfony code, you probably will be able to:

foreach (Request::instance()->files->all() as $file) {
  $filename = str_random(8) . '-' . $file->getClientOriginalName();
  $uploadSuccess = $file->move($destinationPath, $filename);
  // ...
}

Take a look at

Symfony\Component\HttpFoundation\FileBag

and

Symfony\Component\HttpFoundation\ParameterBag

For a better understanding of what you can do with them.