rahulhaque / laravel-filepond

Use FilePond the Laravel way.
MIT License
185 stars 31 forks source link

How to access the data? #28

Closed xfkrahmad closed 1 year ago

xfkrahmad commented 1 year ago

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

rahulhaque commented 1 year ago

@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 commented 1 year ago

@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!!