Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I use JQuery File Upload plugin.
When I click on "choose file" button I send request to server which return list of user's folders. I want to create select with these folders and put into upload template. So user can choose to what folder uploads file. I'm looking a way to put that select box in table.

<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span class="preview"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            <strong class="error text-danger"></strong>
        </td>
        <td>
                <select class="form-control" name="folder[]"><option value="0">Choose folder</option>{%=folderList()%}</select>
        </td>
        <td>
            <p class="size">Processing...</p>
            <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
        </td>
        <td style="display:none">
            {% if (!i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start" disabled>
                    <i class="glyphicon glyphicon-upload"></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script> 

Ideally would be if I could add extra data to UPLOAD table(I know how to add extra data to download table or to server https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-form-data), but is there any way to add additional data before I send ajax call?
So I could do like this

<select class="form-control" name="folder[]"><option value="0">Choose folder</option>{%=file.myselectbox%}</select>

Or maybe there is other way to do it?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.