Commit 0a5c03a5 authored by 王源's avatar 王源 🎧

修改上传文件临时目录判断逻辑

parent 92b4c105
...@@ -172,8 +172,8 @@ class UploadManager ...@@ -172,8 +172,8 @@ class UploadManager
*/ */
public static function parsePath($options, $documentRoot) public static function parsePath($options, $documentRoot)
{ {
if (isset($options['temp']) && $options['temp'] && !isset($options['path'])) { if (isset($options['temp']) && $options['temp']) {
// 如果是临时文件,且没有指定保存路径,修改保存路径为临时路径 // 如果是临时文件,修改保存路径为临时路径
$options['path'] = 'temp'; $options['path'] = 'temp';
} }
$path = $documentRoot . self::$pathPrefix . $options['path'] . '/' . date('Y-m-d'); $path = $documentRoot . self::$pathPrefix . $options['path'] . '/' . date('Y-m-d');
......
...@@ -55,7 +55,7 @@ class ExcelImporter ...@@ -55,7 +55,7 @@ class ExcelImporter
$this->config = container(ConfigInterface::class); $this->config = container(ConfigInterface::class);
$this->fileType = ucfirst($file->getExtension()); $this->fileType = ucfirst($file->getExtension());
$this->rootPath = $this->config->get('server.settings.document_root', BASE_PATH . '/public'); $this->rootPath = $this->config->get('server.settings.document_root', BASE_PATH . '/public');
$path = UploadManager::uploadExcelGetRealPath($file); $path = UploadManager::uploadExcelGetRealPath($file, ['temp' => true]);
$this->reader = IOFactory::createReaderForFile($path)->load($path); $this->reader = IOFactory::createReaderForFile($path)->load($path);
$this->filePath = $path; $this->filePath = $path;
$this->sheet = $this->reader->getSheet($sheetIndex); $this->sheet = $this->reader->getSheet($sheetIndex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment