Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Input for Description
  • Hello, to include an input for further description?

    The User selects the photo .. and then type a description?
  • What are you trying to achieve???? :?:
  • I need a field to put the description, as picture attached, so that I can get this in upload.php file to variable storage in a DB.

    image

    thank's
  • Use scriptData and manually start each item. If you start all of the items in the queue at once, it will use one value for all.
  • Okay, but how do I pass the value of an input to the scriptData?

    as is the scriptData?


    thanks
  • Because you are using multi set to true, your best bet is on each onSelect call add the queueID to an array and set the description input id to "description+queueID". Then change your "Upload" button to run a custom js function instead of the standard fileUploadStart(). In the custom start function it would look something like this

    array.each(function() {
    $('#fileUpload').fileUploadSettings('scriptData', '&decription='+$('#decription'+this.val());
    $('#fileUpload').fileUploadStart(this.val());
    });

    The above code is by no means 100% out of the box working. You would still need to fine tune it, but at least it's a clearer starting point. You must also not if you are limiting the number of simultaneous uploads you will need to handle it by your self. BY using the above code you will bypass the simulatenous upload limit controls built into uploadify
  • I´m also looking for a sulotion of this but to be honest i´m so new into jquery so i dont understand so much.
    Is it possible to get a demo / example of this to download?

    reguards
    Anders
  • I did some changes in js and add text input like this:
    <input type=\"text\" name=\"description' + queueID + '\">\


    it should be define description for each upload item

    but...

    how i put the value of "description" to scriptData? Now i have this:
    'scriptData': {'description':'description'+this.val()+''}, 


    and it doesn't work... how i put js variable (ID of uploaded file) to scriptData?
  • I think i got the same problem http://www.uploadify.com/forum/viewtopic.php?f=7&t=317 and my problem will be solved if you get a answer ;)
  • i don't think so, man... because i need "description input" for each uploaded file and I use multi upload...
  • nobody knows?
  • Open uploadify.js find:

    $('#' + $(this).attr('id') + 'Queue').append('<div id=\"' + $(this).attr('id') + queueID + '\" class=\"fileUploadQueueItem\">\


    Replace with:

    $('#' + $(this).attr('id') + 'Queue').append('<div id=\"' + $(this).attr('id') + queueID + '\" class=\"fileUploadQueueItem\">\
    <div>Decription: <input id=\"description_' + queueID + '\"></div>\


    Change "Upload" button to run a custom js function instead of the standard fileUploadStart():

    $( function() {
    var uploadQueue = new Array();
    $('#fileInput').fileUpload({
    ....,
    'onSelect': function(event, queueID, fileObj)
    {
    uploadQueue.push(queueID);
    },
    ...........
    });

    $('#fileUploadStart').click(function(){
    $.each(uploadQueue, function(k, v){
    $('#fileInput').fileUploadSettings('scriptData', '&amp;description='+$('#description_'+v).val());
    $('#fileInput').fileUploadStart(v);
    }
    );
    });
    });


    HTML page:

    <input type=\"file\" id=\"fileInput\" name=\"fileInput\">
    <button type=\"button\" id=\"fileUploadStart\">Upload start</button>
    <button type=\"button\" onclick=\"$('#fileInput').fileUploadClearQueue();\">Clear queue</button>
  • foolkaka, thanksk, that works :)

    but - if i want upload more than one file, it use one description for all... is there way, how save one description for each item, not one for all?
  • I am also looking for this kind of function. Would like to put a description to each file in the queue, and then hit "upload files". Each description sholud then be passed to upload.php so that I can store in DB.

    If anyone have done something similar, please share... :)
  • HovardKr, I'm working on something similar to that and am awaiting a response from TravisN before I get it finished up this evening. I am building a PHP/MySQL driven photo gallery system and making use of Uploadify. I will post it up in the showcase forum once it's done so that anyone else that needs to can use it.
  • digismack said:
    I will post it up in the showcase forum once it's done so that anyone else that needs to can use it.

    Thats great! Tnx ! Can't wait... :D
  • i also append description of img successfully for your advices.
    that is great! :)
  • any progress of that problem? in past, i dont do that functionality, but now, i need it... it works only if i upload file after file... and i need to work if i want upload many files at once with their own description..

    any advice?
  • digismack posted his version to the showcase. It does what you are asking
    http://uploadify.com/forum/viewtopic.php?f=5&t=615
  • yeah, i saw it, but he rewrite all core of that JS things..
    and i have implemented normally, and i should rewrite all that...
  • You can do it by rewriting onSelect only, but U need to write all functionality that is behind orginal one.

    In short You must to write own queue item with description input.
    On change in description input U collect inputs data from all queue into scriptData variable.
    Because uploadify doesnt send queueID id into server script you must name inputs same as filename,
    so You can get proper description for each file.

    Bad side of this implementation is that You send all descriptions for first queue item,
    and for each next file one less that previous (cos queue clears of uploaded files).