Duplicated file on binding
Closed this issue · 3 comments
Hi team!. I'm using Laravel 5.4, i installed laravel-attachments Version 0.0.16 as suggested in documentation.
I'm storing a file usign Laravel Storage::put()
method, then getting the url with Storage::url(
) and then passing this path to the $model->attach($path, $options)
method.
Basically my problem is that once i execute $model->attach($path, $options)
, a new file is created in the "attachments" folder.
For this project i'm using Amazon s3 Storage and we're not about upgrading Laravel so far.
I really hope you could tell me how could i fix this or tell me what i am doing wrong.
Thanks!
HI,
I don't get any file stored locally on the server when using S3 storage like this
$model->attach($someFile, [
'disk' => 's3',
]);
where s3 is the name of a disk in config/filesystems.php
:
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
Hi again!
Excuse me, I'm not sure what kind of data do you store on $someFile
var when you're using S3
storage.
I only can get the URL
from S3
after i upload a file.
I would love if i just could attach a image from URL
.
Thanks!
The code :
$model->attach($someFile, [
'disk' => 's3',
]);
is used to upload a file to S3 : $someFile
is a local path to a file or an instance of UploadedFile