rahulhaque/laravel-filepond

How to access the data?

xfkrahmad opened this issue · 2 comments

Screenshot_116
I using a spatie media, so i need a string of the image path. for now i just do like on the screenshot, and i believe this is incorrect ways.
thank for your response

@xfkrahmad use the getFile() method to get the file object to work with. With Spatie's media library package, it is as easy as -

// Single file
$product->addMedia(Filepond::field($request->image)->getFile())->usingName('...')->toMediaCollection('...');

// Multiple files
$images = Filepond::field($request->images)->getFile();
foreach ($images as $image) {
    $product->addMedia($image)->usingName('...')->toMediaCollection('...');
}

@xfkrahmad use the getFile() method to get the file object to work with. With Spatie's media library package, it is as easy as -

// Single file
$product->addMedia(Filepond::field($request->image)->getFile())->usingName('...')->toMediaCollection('...');

// Multiple files
$images = Filepond::field($request->images)->getFile();
foreach ($images as $image) {
    $product->addMedia($image)->usingName('...')->toMediaCollection('...');
}

thank you!!