Update a file input

Posted 8 months ago by mcardosob

Hello everyone

I have a CRUD controller (ClientController). In my create action I create a client with a multiple attachment file.

For this, I have a table named "client_attachments" with a id_client and the path for locate the file.

The problem is that I want to create a update action. I want that in the update view the user can delete the attachements or add a new attachment.

For this I was thinking create a javascript array when the client delete an existing attachement, the id of attachment is stocked in this array.

Like this when the client send the form, my javascript send the array (containing all id of attachments to delete) to my update action for delete the correspondant attachments with id passed.

I want to know if this methodology is the best practise?

If it is the best practise, I want to pass my javascript array to my controller jointly to my other fields presents in my request?

I hope I am obvious (I'm not the best english writter, thanks for yours understanding).

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.