This commit is contained in:
2023-08-29 15:38:37 +10:00
parent 4b0c113941
commit b01c5d57c7
2 changed files with 9 additions and 3 deletions

View File

@@ -69,9 +69,11 @@ function tempFileInfo(string $filePath): array
function tempFileExists(string $dir, string $name, string $extension = '', string $part = ''): string function tempFileExists(string $dir, string $name, string $extension = '', string $part = ''): string
{ {
$filename = constructTempFileName($dir, $name, $extension, $part); $filename = constructTempFileName($dir, $name, $extension, $part);
Log::Info($filename);
$exists = file_exists($filename);
return file_exists($filename); Log::Info($filename . ' ' . ($exists ? 'true' : 'false'));
return $exists;
} }
/** /**

View File

@@ -10,6 +10,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile; use Illuminate\Http\UploadedFile;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
use Laravel\Sanctum\PersonalAccessToken; use Laravel\Sanctum\PersonalAccessToken;
class MediaController extends ApiController class MediaController extends ApiController
@@ -113,6 +114,9 @@ class MediaController extends ApiController
$mediaItem = $request->user()->media()->create($request->except(['file','transform'])); $mediaItem = $request->user()->media()->create($request->except(['file','transform']));
Log::info($mediaItem->name);
Log::info(pathinfo($mediaItem->name, PATHINFO_EXTENSION));
$temporaryFilePath = generateTempFilePath(pathinfo($mediaItem->name, PATHINFO_EXTENSION), $request->get('chunk', '')); $temporaryFilePath = generateTempFilePath(pathinfo($mediaItem->name, PATHINFO_EXTENSION), $request->get('chunk', ''));
copy($file->path(), $temporaryFilePath); copy($file->path(), $temporaryFilePath);