CodeSleeve / laravel-stapler

Stapler-based file upload package for the Laravel framework.
MIT License
556 stars 109 forks source link

Uploading multiple Images? #101

Closed mikimaine closed 8 years ago

mikimaine commented 8 years ago

i want to add multiple image for a single product?

doesnt accept array of images?

Patroklo commented 8 years ago

For what I have learned about the module, you can add an additional class to store them like a gallery.

user -> user_images

With only id, user_id fields (for example) to make the user_images model. Then add the image parameter to that model and will work as an array of images.

Patroklo commented 8 years ago

Also, just found this library that works over laravel-stapler that could be just what you need https://github.com/benallfree/laravel-stapler-images

tabennett commented 8 years ago

You need to create another table (call it product_images) that belongsTo a product. That's the model (ProductImage) that you want to define your stapler attachments on. Then, you'll be able to associate many product images to a single product.

There are examples of how to do this already in the docs and here's another example from Stackoverflow that also show how to do this type of thing.

Patroklo commented 7 years ago

Also, just updated a library that automatices the multiuploading and multiple file handling https://github.com/Patroklo/laravel-multiple-stapler