Skip to content

Commit

Permalink
fix: update file upload function
Browse files Browse the repository at this point in the history
  • Loading branch information
joy2362 committed Jul 18, 2023
1 parent c11dcfb commit 6f921f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Helper/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public static function upload($file, $path, $old = null)
{
$code = date('ymdhis') . '-' . rand(1111, 9999);
if (!empty($old)) {
$oldFile = oldFile($old);
$oldFile = self::oldFile($old);
if (Storage::disk('public')->exists($oldFile)) {
Storage::disk('public')->delete($oldFile);
}
}
//FILE UPLOAD
if (!empty($file)) {
$fileName = $code . "." . $file->getClientOriginalExtension();
makeDir($path);
self::makeDir($path);
return Storage::disk('public')->putFileAs('upload/' . $path, $file, $fileName);
}
}
Expand Down

0 comments on commit 6f921f4

Please sign in to comment.