public function fancyUpload(Request $request, $transformConfig = [], $appendedPath = null)
    {
        if ($request->hasFile('file')) {
            foreach ($request->file('file') as $file) {
                if ($file->isValid()) {
                    $uploadedFile = $this->uploadFile($file, $transformConfig, $appendedPath);

                    // Generate return information
                    if ($uploadedFile) {
                        return $this->generateFancyUploadResponse($request, $uploadedFile);
                    }
                } else {
                    throw new UploadException('File not valid.');
                }
            }
        }

        throw new UploadException('No valid files to upload');
    }
public function fancyUpload(Request $request, $transformConfig = [], $appendedPath = null)
    {
        if ($request->hasFile('file')) {
            foreach ($request->file('file') as $file) {
                if ($file->isValid()) {
                    $uploadedFile = $this->uploadFile($file, $transformConfig, $appendedPath);

                    // Generate return information
                    if ($uploadedFile) {
                        return $this->generateFancyUploadResponse($request, $uploadedFile);
                    }
                } else {
                    throw new UploadException('File not valid.');
                }
            }
        }

        throw new UploadException('No valid files to upload');
    }
public function fancyUpload ( Request $ request , $ transformConfig = [ ] , $ appendedPath = null ) { if ( $ request -> hasFile ( 'file' ) ) { foreach ( $ request -> file ( 'file' ) as $ file ) { if ( $ file -> isValid ( ) ) { $ uploadedFile = $ this -> uploadFile ( $ file , $ transformConfig , $ appendedPath ) ; // Generate return information if ( $ uploadedFile ) { return $ this -> generateFancyUploadResponse ( $ request , $ uploadedFile ) ; } } else { throw new UploadException ( 'File not valid.' ) ; } } } throw new UploadException ( 'No valid files to upload' ) ; }
Uploads a file and returns a response to be consumed by
bootstrap-fileinput jQuery plugin.

@param Request $request
@param array   $transformConfig
@param         $appendedPath

@return array|\Illuminate\Http\JsonResponse
Uploads a file and returns a response to be consumed by bootstrap - fileinput jQuery plugin .