getFiles() public method

Gets the file field values.
public getFiles ( ) : array
return array An array of file field values
Exemplo n.º 1
0
 protected function makeRequestUsingForm(Form $form)
 {
     $files = [];
     $plainFiles = $form->getFiles();
     foreach ($plainFiles as $key => $file) {
         $files[$key] = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error'], true);
     }
     return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $files);
 }
 /**
  * Convert the given uploads to UploadedFile instances.
  *
  * @param  \Symfony\Component\DomCrawler\Form  $form
  * @param  array  $uploads
  * @return array
  */
 protected function convertUploadsForTesting(Form $form, array $uploads)
 {
     $files = $form->getFiles();
     $names = array_keys($files);
     $files = array_map(function (array $file, $name) use($uploads) {
         return isset($uploads[$name]) ? $this->getUploadedFileForTesting($file, $uploads, $name) : $file;
     }, $files, $names);
     return array_combine($names, $files);
 }
Exemplo n.º 3
0
 /**
  * Make a request to a URL using form parameters.
  *
  * @param  Form $form
  * @return static
  */
 protected function makeRequestUsingForm(Form $form)
 {
     return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $form->getFiles());
 }
Exemplo n.º 4
0
 /**
  * Converts form files to UploadedFile instances.
  *
  * @param  Form $form
  * @return array
  */
 protected function convertFormFiles(Form $form)
 {
     $files = $form->getFiles();
     $names = array_keys($files);
     $files = array_map(function ($file, $name) {
         if (isset($this->files[$name])) {
             $absolutePath = $this->files[$name];
             $file = new UploadedFile($file['tmp_name'], basename($absolutePath), $file['type'], $file['size'], $file['error'], true);
         }
         return $file;
     }, $files, $names);
     return array_combine($names, $files);
 }
Exemplo n.º 5
0
 /**
  * Convert the given uploads to UploadedFile instances.
  *
  * @param  \Symfony\Component\DomCrawler\Form  $form
  * @param  array  $uploads
  * @return array
  */
 protected function convertUploadsForTesting(Form $form, array $uploads)
 {
     $files = $form->getFiles();
     $names = array_keys($files);
     $files = array_map(function (array $file, $name) use($uploads) {
         return isset($uploads[$name]) ? $this->getUploadedFileForTesting($file, $uploads, $name) : $file;
     }, $files, $names);
     $uploads = array_combine($names, $files);
     foreach ($uploads as $key => $file) {
         if (preg_match('/.*?(?:\\[.*?\\])+/', $key)) {
             $this->prepareArrayBasedFileInput($uploads, $key, $file);
         }
     }
     return $uploads;
 }