@@ 418-435 (lines=18) @@ | ||
415 | * @param string $uploadField |
|
416 | * @return string |
|
417 | */ |
|
418 | public function getUploadFileUrl(string $uploadField) : string |
|
419 | { |
|
420 | $fallBack = ''; |
|
421 | ||
422 | $Url = $this->getUploadFileFullPath($uploadField); |
|
423 | if($Url===null || $Url=='') |
|
424 | { |
|
425 | return $fallBack; |
|
426 | } |
|
427 | ||
428 | $uploadFieldPath = str_replace(public_path(), '', $Url); |
|
429 | ||
430 | if ($uploadFieldPath === null || $uploadFieldPath == '' || $uploadFieldPath == '/') { |
|
431 | return $fallBack; |
|
432 | } |
|
433 | ||
434 | return URL::to($uploadFieldPath); |
|
435 | } |
|
436 | /** |
|
437 | * Return the base url (without filename) for the passed attribute. |
|
438 | * Returns empty string if dir if not exists. |
|
@@ 443-460 (lines=18) @@ | ||
440 | * @param string $uploadField |
|
441 | * @return string |
|
442 | */ |
|
443 | public function getUploadFileBaseUrl(string $uploadField) : string |
|
444 | { |
|
445 | $fallBack = ''; |
|
446 | ||
447 | $uploadFieldPath = $this->getUploadFileBasePath($uploadField); |
|
448 | if($uploadFieldPath===null || $uploadFieldPath=='') |
|
449 | { |
|
450 | return $fallBack; |
|
451 | } |
|
452 | ||
453 | $uploadFieldPath = DirHelper::addFinalSlash(str_replace(public_path(), '', $uploadFieldPath)); |
|
454 | ||
455 | if ($uploadFieldPath === null || $uploadFieldPath == '' || $uploadFieldPath == '/') { |
|
456 | return $fallBack; |
|
457 | } |
|
458 | ||
459 | return URL::to($uploadFieldPath); |
|
460 | } |
|
461 | ||
462 | /** |
|
463 | * Calcolate the new name for ALL uploaded files and set relative upload attributes |