Skip to content

Commit

Permalink
update fileinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
steevenz committed Oct 13, 2018
1 parent cdfd759 commit 3133a22
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Handlers/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ public function process($field = null)

$targetPath = $this->path;

if ( ! is_writable($targetPath)) {
if ( ! file_exists($targetPath)) {
mkdir($targetPath, 0777, true);
}
}

if (empty($this->targetFilename)) {
$this->setTargetFilename($file->getClientFilename());
}
Expand Down Expand Up @@ -448,7 +454,8 @@ protected function validate(UploadFile $file)
protected function move(UploadFile $file, $targetPath)
{
$fileInfo = [
'name' => $file->getClientFilename(),
'name' => pathinfo($targetPath, PATHINFO_BASENAME),
'path' => $targetPath,
'mime' => $file->getFileMime(),
'size' => $file->getSize()
];
Expand Down

0 comments on commit 3133a22

Please sign in to comment.