Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -469,7 +469,7 @@ class _FileSystem extends \IPS\File
|
||||
|
||||
$this->setFilename( $filename, $obscure );
|
||||
|
||||
$return = array( 'temp' => "{$this->configuration['dir']}/{$tempFolder}/chunk-" . md5( uniqid() ) . '.txt', 'final' => "{$folder}/" . $this->filename );
|
||||
$return = array( 'temp' => "{$this->configuration['dir']}/{$tempFolder}/chunk-" . md5( uniqid() ) . '.txt', 'final' => "{$folder}/" . $this->filename, 'original' => $this->originalFilename );
|
||||
touch( $return['temp'] );
|
||||
return $return;
|
||||
}
|
||||
@@ -509,18 +509,28 @@ class _FileSystem extends \IPS\File
|
||||
|
||||
return $ref;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finalize a chunked upload
|
||||
*
|
||||
* @param mixed $ref The reference for this upload as returned by chunkInit()
|
||||
* @return string The file's reference which can be passed to \IPS\File::get() as the URL
|
||||
* @throws \RuntimeException
|
||||
* @param array $ref The reference for this upload as returned by chunkInit()
|
||||
* @param string $storageConfiguration Storage configuration name
|
||||
* @return \IPS\File The file object just created
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function chunkFinish( $ref )
|
||||
public function chunkFinish( array $ref, string $storageConfiguration ): \IPS\File
|
||||
{
|
||||
rename( $ref['temp'], "{$this->configuration['dir']}/{$ref['final']}" );
|
||||
return $ref['final'];
|
||||
|
||||
$fileObj = \IPS\File::get( $storageConfiguration,$ref['final'] );
|
||||
|
||||
/* This isn't preserved for chunk uploads, so we need to set it so apps can get the real value */
|
||||
if( !empty( $ref['original'] ) )
|
||||
{
|
||||
$fileObj->originalFilename = $ref['original'];
|
||||
}
|
||||
|
||||
return $fileObj;
|
||||
}
|
||||
|
||||
/* !File System Utility Methods */
|
||||
|
||||
Reference in new issue
Block a user