Skip to content

Commit 3133a22

Browse files
committed
update fileinfo
1 parent cdfd759 commit 3133a22

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Handlers/Uploader.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ public function process($field = null)
325325

326326
$targetPath = $this->path;
327327

328+
if ( ! is_writable($targetPath)) {
329+
if ( ! file_exists($targetPath)) {
330+
mkdir($targetPath, 0777, true);
331+
}
332+
}
333+
328334
if (empty($this->targetFilename)) {
329335
$this->setTargetFilename($file->getClientFilename());
330336
}
@@ -448,7 +454,8 @@ protected function validate(UploadFile $file)
448454
protected function move(UploadFile $file, $targetPath)
449455
{
450456
$fileInfo = [
451-
'name' => $file->getClientFilename(),
457+
'name' => pathinfo($targetPath, PATHINFO_BASENAME),
458+
'path' => $targetPath,
452459
'mime' => $file->getFileMime(),
453460
'size' => $file->getSize()
454461
];

0 commit comments

Comments
 (0)