Skip to content

Commit e98b3e3

Browse files
committed
fix upload file bug
1 parent 47eb862 commit e98b3e3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Upload/UploadedFile.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function moveTo($targetPath): void
104104
{
105105
$targetPath = \Swoft::getAlias($targetPath);
106106
$this->validateActive();
107-
if (! $this->isStringNotEmpty($targetPath)) {
107+
if (!$this->isStringNotEmpty($targetPath)) {
108108
throw new \InvalidArgumentException('Invalid path provided for move operation');
109109
}
110110

111111
if ($this->file) {
112112
$this->validateSavePath($targetPath);
113113
$this->moved = move_uploaded_file($this->file, $targetPath);
114114
}
115-
if (! $this->moved) {
115+
if (!$this->moved) {
116116
throw new \RuntimeException(sprintf('Uploaded file could not be move to %s', $targetPath));
117117
}
118118
}
@@ -278,10 +278,11 @@ public function validateActive()
278278
* check file savePath
279279
* @param $targetPath
280280
*/
281-
public function validateSavePath($targetPath){
281+
public function validateSavePath($targetPath)
282+
{
282283
$dir = dirname($targetPath);
283-
if (!is_dir($dir)&&!file_exists($dir)){
284-
if(!mkdir($dir,0777,true)){
284+
if (!is_dir($dir) && !file_exists($dir)) {
285+
if (!mkdir($dir, 0777, true)) {
285286
throw new \RuntimeException("Cannot create directory");
286287
}
287288
}

0 commit comments

Comments
 (0)