jQuery-File-Upload icon indicating copy to clipboard operation
jQuery-File-Upload copied to clipboard

How to sent input-Tag by clicking on delete-Button?

Open AndryXY opened this issue 15 years ago • 3 comments

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.

AndryXY avatar Sep 10 '11 04:09 AndryXY

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.

blueimp avatar Sep 10 '11 08:09 blueimp

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.

AndryXY avatar Sep 10 '11 15:09 AndryXY

Please read: https://github.com/blueimp/jQuery-File-Upload#support

blueimp avatar Sep 06 '12 04:09 blueimp