fixed S3 download functionality
This commit is contained in:
parent
85db96ed37
commit
e68158aef2
1 changed files with 30 additions and 86 deletions
|
|
@ -457,20 +457,10 @@ class FileController extends Controller
|
|||
else {
|
||||
// create a new path
|
||||
$path = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// if file has been uploaded to S3,
|
||||
if ($file->s3 == 1) {
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
} else {
|
||||
// modify path
|
||||
$path = 'public/' . $path;
|
||||
// get local file
|
||||
$localFile = Storage::disk('local')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $localFile);
|
||||
}
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
// define download path as being the file on the public drive
|
||||
$downloadURL = asset(Storage::disk('public')->url($path));
|
||||
// define filename
|
||||
|
|
@ -538,20 +528,10 @@ class FileController extends Controller
|
|||
else {
|
||||
// create a new path
|
||||
$path = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// if file has been uploaded to S3,
|
||||
if ($file->s3 == 1) {
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
} else {
|
||||
// modify path
|
||||
$path = 'public/' . $path;
|
||||
// get local file
|
||||
$localFile = Storage::disk('local')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $localFile);
|
||||
}
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
// define download path as being the file on the public drive
|
||||
$downloadURL = asset(Storage::disk('public')->url($path));
|
||||
// define filename
|
||||
|
|
@ -608,22 +588,12 @@ class FileController extends Controller
|
|||
}
|
||||
// otherwise
|
||||
else {
|
||||
// create a new path off
|
||||
// create a new path
|
||||
$path = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// if file has been uploaded to S3,
|
||||
if ($file->s3 == 1) {
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
} else {
|
||||
// modify path
|
||||
$path = 'public/' . $path;
|
||||
// get local file
|
||||
$localFile = Storage::disk('local')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $localFile);
|
||||
}
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
// define download path as being the file on the public drive
|
||||
$downloadURL = asset(Storage::disk('public')->url($path));
|
||||
// define filename
|
||||
|
|
@ -692,20 +662,10 @@ class FileController extends Controller
|
|||
else {
|
||||
// create a new path
|
||||
$path = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// if file has been uploaded to S3,
|
||||
if ($file->s3 == 1) {
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
} else {
|
||||
// modify path
|
||||
$path = 'public/' . $path;
|
||||
// get local file
|
||||
$localFile = Storage::disk('local')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $localFile);
|
||||
}
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
// define download path as being the file on the public drive
|
||||
$downloadURL = asset(Storage::disk('public')->url($path));
|
||||
// define filename
|
||||
|
|
@ -762,22 +722,12 @@ class FileController extends Controller
|
|||
}
|
||||
// otherwise
|
||||
else {
|
||||
// create a new path off "public/"
|
||||
// create a new path
|
||||
$path = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// if file has been uploaded to S3,
|
||||
if ($file->s3 == 1) {
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
} else {
|
||||
// modify path
|
||||
$path = 'public/' . $path;
|
||||
// get local file
|
||||
$localFile = Storage::disk('local')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $localFile);
|
||||
}
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($path, $s3file);
|
||||
// define download path as being the file on the public drive
|
||||
$downloadURL = asset(Storage::disk('public')->url($path));
|
||||
// define filename
|
||||
|
|
@ -1076,20 +1026,14 @@ class FileController extends Controller
|
|||
if ($file->children->isEmpty()) {
|
||||
// set $internalPath to reflect file
|
||||
$internalPath = $parent . $file->name;
|
||||
// default file path is stored on local storage
|
||||
$filePath = Storage::disk('local')->path($file->stored_at);
|
||||
|
||||
// if the file is uploaded to S3
|
||||
if ($file->s3 == 1) {
|
||||
// create a new path
|
||||
$filePath = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// pull the file off S3
|
||||
$s3file = Storage::get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($filePath, $s3file);
|
||||
// reassign $filePath to the actual file path
|
||||
$filePath = Storage::disk('public')->path($filePath);
|
||||
}
|
||||
// create a new path
|
||||
$filePath = pathinfo($file->stored_at, PATHINFO_BASENAME);
|
||||
// pull the file off S3
|
||||
$s3file = Storage::disk('s3')->get($file->stored_at);
|
||||
// put it on the public drive for use
|
||||
Storage::disk('public')->put($filePath, $s3file);
|
||||
// reassign $filePath to the actual file path
|
||||
$filePath = Storage::disk('public')->path($filePath);
|
||||
|
||||
// add file to archive
|
||||
$archive->addFile($filePath, $internalPath);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue