96 $this->processed =
false;
98 $this->uploadResult = [];
99 $this->rejectedUploadResult = [];
109 $file_stream = $this->uploadStreams[$identifier];
110 $uri = $file_stream->getMetadata(
'uri');
111 $file_stream->close();
113 unset($this->uploadStreams[$identifier]);
114 unset($_FILES[$identifier]);
123 if ($this->processed ===
false) {
124 throw new \RuntimeException(
'Can not move unprocessed files.');
134 $path = rtrim($destination,
"/") .
'/' . ($file_name ==
"" ? $uploadResult->
getName() : $file_name);
135 if ($override_existing && $filesystem->has($path)) {
136 $filesystem->delete($path);
151 if ($this->processed ===
false) {
152 throw new \RuntimeException(
'Can not move unprocessed files.');
155 if ($this->moved ===
true) {
156 throw new \RuntimeException(
'Can not move the files a second time.');
176 $this->uploadResult = $tempResults;
177 $this->uploadStreams = null;
247 throw new \InvalidArgumentException(
"No filesystem found for location code \"$location\"");
257 return \ilUtil::getUploadSizeLimitBytes();
266 if ($this->processed ===
false) {
267 $this->processorManager->with($preProcessor);
279 if ($this->processed ===
true) {
286 $uploadedFiles = $this->globalHttpState->request()->getUploadedFiles();
288 foreach ($collectFilesFromNestedFields as $file) {
289 $metadata =
new Metadata($file->getClientFilename(), $file->getSize(), $file->getClientMediaType());
298 $identifier = $file->getStream()->getMetadata(
'uri');
300 $identifier = is_array($identifier) ?
'' : $identifier;
302 $this->uploadStreams[$identifier] = $stream;
304 if ($file->getError() === UPLOAD_ERR_OK) {
305 $processingResult = $this->processorManager->process($stream, $metadata);
314 $metadata->getFilename(),
315 $metadata->getUploadSize(),
316 $metadata->getMimeType(),
317 $metadata->additionalMetaData(),
319 is_string($identifier)?$identifier:
'' 321 $this->uploadResult[$identifier] =
$result;
327 $this->processed =
true;
353 $this->rejectedUploadResult[] =
$result;
362 if ($this->processed) {
363 return array_merge($this->uploadResult, $this->rejectedUploadResult);
379 $uploadedFiles = $this->
flattenUploadedFiles($this->globalHttpState->request()->getUploadedFiles());
381 return (count($uploadedFiles) > 0);
395 RecursiveArrayIterator::CHILD_ARRAYS_ONLY
397 RecursiveIteratorIterator::LEAVES_ONLY
400 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)
Class IOException Indicates general problems with the input or output operations. ...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
flattenUploadedFiles($uploadedFiles)
static filesystems()
Returns the loaded filesystems.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
const DENIED
Upload got denied by a processor, the upload will be removed immediately.
regenerateUploadResultWithPath(UploadResult $result, $path)
Generate an exact copy of the result with the given path.
Class ImmutableMapWrapper.
const TEMPORARY
The ILIAS temporary directory.
Exercise XML Parser which completes/updates a given file by an xml string.
hardRemoveUpload(string $identifier)
This is the very last thing we can do if a preprocessor DENIEs an upload.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const WEB
The filesystem within the ilias web root.
Class Filesystems The Filesystems interface defines the access methods which can be used to fetch the...
static ofPsr7Stream(StreamInterface $stream)
Create a FileStream from a Psr7 compliant stream.