Support the ongoing development of Laravel.io →
Requests Input Views

Hi all!

I have a little problem, this is my code:

http://laravel.io/bin/2zjVG

I'm showing all the images that are saved in a folder. I want to add a checkbox for each image so that the user can select the images he wants to download, and when he presses the button "download" only the marked images are downloaded.

My problem is that I do not know how to collect the marked images and pass them to my function that is in the controller.

Could someone help me about this in some advice or example?

Thank you in advance.

Last updated 3 years ago.
0

If you want to do this without Javascript:

Move your Form::open() to before <table>

Change checkbox name to img[] rather than img

Once the form is submitted you will then have an array of paths (I assume they are actually URIs) in Input::get('img')

Last updated 3 years ago.
0

Thank you very much for your response.

Then, do you think that my code could be like this no?:

http://laravel.io/bin/ek0wo

I keep the array in variable image, and send it to the controller to do download all, right?

Last updated 3 years ago.
0

I don't understand what you are doing in this bit:

            <?php
	    	    $images = Input::get('img');
            ?>
            {{ Form::hidden('images', $images) }}

You should be posting the form and sending the download from there

Last updated 3 years ago.
0

This bit is a mistake sorry! and thank you for your response!

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

despotars despotars Joined 15 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.