80 $this->processed =
false;
82 $this->uploadResult = [];
83 $this->rejectedUploadResult = [];
91 if ($this->processed ===
false) {
92 throw new \RuntimeException(
'Can not move unprocessed files.');
103 if ($override_existing && $filesystem->has(
$path)) {
104 $filesystem->delete(
$path);
119 if ($this->processed ===
false) {
120 throw new \RuntimeException(
'Can not move unprocessed files.');
123 if ($this->moved ===
true) {
124 throw new \RuntimeException(
'Can not move the files a second time.');
144 $this->uploadResult = $tempResults;
145 $this->uploadStreams = null;
215 throw new \InvalidArgumentException(
"No filesystem found for location code \"$location\"");
225 return \ilUtil::getUploadSizeLimitBytes();
234 if ($this->processed ===
false) {
235 $this->processorManager->with($preProcessor);
247 if ($this->processed ===
true) {
254 $uploadedFiles = $this->globalHttpState->request()->getUploadedFiles();
256 foreach ($collectFilesFromNestedFields as $file) {
257 $metadata =
new Metadata($file->getClientFilename(), $file->getSize(), $file->getClientMediaType());
266 $identifier = $file->getStream()->getMetadata(
'uri');
268 $identifier = is_array($identifier) ?
'' : $identifier;
270 $this->uploadStreams[$identifier] =
$stream;
272 if ($file->getError() === UPLOAD_ERR_OK) {
280 is_string($identifier)?$identifier:
'' 282 $this->uploadResult[$identifier] =
$result;
288 $this->processed =
true;
314 $this->rejectedUploadResult[] =
$result;
323 if ($this->processed) {
324 return array_merge($this->uploadResult, $this->rejectedUploadResult);
340 $uploadedFiles = $this->
flattenUploadedFiles($this->globalHttpState->request()->getUploadedFiles());
342 return (count($uploadedFiles) > 0);
356 RecursiveArrayIterator::CHILD_ARRAYS_ONLY
358 RecursiveIteratorIterator::LEAVES_ONLY
361 return iterator_to_array($recursiveIterator,
false);
rejectFailedUpload(UploadedFileInterface $file, Metadata $metadata)
Reject a failed upload with the given metadata.
Interface GlobalHttpState.
const REJECTED
Upload got rejected by a processor.
process()
Invokes all preprocessors for each uploaded file in the sequence they got registered.
moveFilesTo($destination, $location=Location::STORAGE)
const STORAGE
The filesystem outside of the ilias web root.
Class PreProcessorManager.
__construct(PreProcessorManager $processorManager, Filesystems $filesystems, GlobalHttpState $globalHttpState)
FileUploadImpl constructor.
regenerateUploadResultWithCopyError(UploadResult $result, $errorReason)
Creates a clone of the given result and set the status to rejected with the passed error message...
Class IllegalStateException.
Class EntryLockingStringMap.
moveOneFileTo(UploadResult $uploadResult, $destination, $location=Location::STORAGE, $file_name='', $override_existing=false)
Moves a single File (the attributes, metadata and upload-status of which are contained in UploadResul...
selectFilesystem($location)
Selects the correct filesystem by the given Location constant.
$metadata['__DYNAMIC:1__']
$stream
PHP stream implementation.
flattenUploadedFiles($uploadedFiles)
static filesystems()
Returns the loaded filesystems.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
regenerateUploadResultWithPath(UploadResult $result, $path)
Generate an exact copy of the result with the given path.
Class ImmutableMapWrapper.
const TEMPORARY
The ILIAS temporary directory.
Value object representing a file uploaded through an HTTP request.
const WEB
The filesystem within the ilias web root.
static ofPsr7Stream(StreamInterface $stream)
Create a FileStream from a Psr7 compliant stream.