Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access the data? #28

Closed
xfkrahmad opened this issue Nov 26, 2022 · 2 comments
Closed

How to access the data? #28

xfkrahmad opened this issue Nov 26, 2022 · 2 comments

Comments

@xfkrahmad
Copy link

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
Copy link
Owner

@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
Copy link
Author

xfkrahmad commented Nov 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants