Skip to content

Commit ea1c1d8

Browse files
committed
feat: attempt dynamic url generation for uploads
1 parent 7274602 commit ea1c1d8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/FS/File.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ public static function upload($file, string $destination, array $options = [])
531531
'type' => static::type($name),
532532
'path' => (new Path($destination . DIRECTORY_SEPARATOR . $name))->normalize(),
533533
'extension' => (new Path($name))->extension(),
534+
'url' => ($_ENV['APP_URL'] ?? '/') . str_replace('storage/app/public', 'storage', str_replace(
535+
str_replace(['public/index.php', 'index.php'], '', $_SERVER['SCRIPT_FILENAME']),
536+
'',
537+
(new Path($destination . DIRECTORY_SEPARATOR . $name))->normalize()
538+
))
534539
];
535540

536541
try {

0 commit comments

Comments
 (0)