Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add fields to be uploaded with files #21

Open
daphnawegner opened this issue Jan 30, 2015 · 4 comments
Open

How to add fields to be uploaded with files #21

daphnawegner opened this issue Jan 30, 2015 · 4 comments

Comments

@daphnawegner
Copy link

How would I add some more fields that are associated with each upload. For example I want the user to give a title each uploaded file and have it saved in the Model. I looked at the demo but I am not clear on how to do that?

@adamteale
Copy link

Hey guys I'd really like to know how to do this too.

@Nasjoe
Copy link

Nasjoe commented Dec 17, 2015

Hi ! Did you find the solution ?
I'm trying this the "Setting formData on upload start for each individual file upload" on : https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-form-data#adding-input-fields-to-the-upload-form

i add some html input within the template, and for js :

$('#fileupload').bind('fileuploadsubmit', function (e, data) {
var inputs = data.context.find(':input')
data.formData = inputs.serializeArray();
console.log(data);

The console log in Firebug give me the value in "formData", but i don't know how to get this value in Django/python.

Did you solve that ?
Thanks.

@adamteale
Copy link

Hey Nasjoe,

It has been quite a while since I got this working, just managed to pull up the project.
This is what i had:

$('#fileupload').bind('fileuploadsubmit', function (e, data) {
    var itemTitle = $('#fileupload').find('input[name="title"]').val();
    var directoryID = $( "#id_directoryField option:selected" ).val();
    var proyectoID = $( "#id_proyectoField option:selected" ).val();

    formData.push( 
        { name: "itemTitle", value: itemTitle }, { name: "directoryID", value: directoryID }, { name: "proyectoID", value: proyectoID }
    );
});

Is that the idea?

Cheers
Adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants