How to sent input-Tag by clicking on delete-Button?
Hi @all,
I programmed a php-folder-system for the jQuery-File-Upload. When I am uploading new images in different folders, everything works fine. (I write the folder-ID in a hidden input-Tag. By clicking on uploading-images the values are also sent to the server) My problem is: When I want to delete a file from the server I must sent the folder-ID too. But only the filename is sent by clicking on the delete-Button. I give this method a try:
<td class="delete">
<button data-type="${delete_type}" data-url="${delete_url}&token=4F829C37A52C94AD">Delete</button>
</td>
(https://github.com/blueimp/jQuery-File-Upload/issues/241)
But it doesn't work and I don't know how to put the hidden input-Tag value as token.
I hope you can help! :(
Greetings from germany Andy
PS: Sorry for my bad english.
The approach posted by MaxEvron that you linked to in your issue should work: https://github.com/blueimp/jQuery-File-Upload/issues/241#issuecomment-1401623
He also explains how to add a token parameter to the deletion url on server-side.
Yes, he did. But how can I put the token to the html<form action=...?token=...> ?
The following don't work because it's a dynamic script and I don't know the folder, when the site is loading.
<form action="/upload?token=4F829C37A52C94AD" method="POST" enctype="multipart/form-data">
How to get the token an server-side I already know ;) But how to set without using the action-url I don't know :(
Edit: When I want to use this way:
<button data-type="${delete_type}" data-url="${delete_url}&token=4F829C37A52C94AD">Delete</button>
I don't know how to set the token value from an input value to the delete-button. The following don't work:
<from action=...>
<div class="fileupload-buttonbar">
<label class="fileinput-button">
<span>select files</span>
<input type="file" name="files[]" multiple>
</label>
<button type="submit" class="start">upload</button>
<button type="reset" class="cancel">cancel</button>
<button type="button" class="delete">delete files</button>
</div>
<input type="hidden" name="test" value="123" id="test">
</form>
...
<script id="template-upload" type="text/x-jquery-tmpl">
...
{{/if}}
<td class="delete">
<button data-type="${delete_type}" data-url="${delete_url}&test=${test}">delete</button>
</td>
Maybe my problem is better to understand like this.
Please read: https://github.com/blueimp/jQuery-File-Upload#support