Need help extending AjaxFileUpload Plugin with JQuery

Discussion in 'Javascript' started by Big Moxy, Dec 22, 2007.

  1. Big Moxy

    Big Moxy Guest

    This plugin can be downloaded from http://www.phpletter.com/DOWNLOAD/.
    I want to add 2 fields to the sample form but do not know how. The
    variable s.fileElementId in the function ajaxFileUpload below is the
    name of the file to be uploaded. I can see where it is added to the
    form in the createUploadForm.

    Can someone please show me how to add 2 fields to this form so that I
    can use it in the php script called by the form action method?

    Thank you!!
    Tim


    createUploadForm: function(id, fileElementId)
    {
    //create form
    var formId = 'jUploadForm' + id;
    var fileId = 'jUploadFile' + id;
    var form = $('<form action="" method="POST" name="' + formId + '"
    id="' + formId + '" enctype="multipart/form-data"></form>');
    var oldElement = $('#' + fileElementId);
    var newElement = $(oldElement).clone();
    $(oldElement).attr('id', fileId);
    $(oldElement).before(newElement);
    $(oldElement).appendTo(form);
    //set attributes
    $(form).css('position', 'absolute');
    $(form).css('top', '-1200px');
    $(form).css('left', '-1200px');
    $(form).appendTo('body');
    return form;
    },

    ajaxFileUpload: function(s) {
    // TODO introduce global settings, allowing the client to
    modify them for all requests, not only timeout
    s = jQuery.extend({}, jQuery.ajaxSettings, s);
    var id = new Date().getTime()
    var form = jQuery.createUploadForm(id, s.fileElementId);
    var io = jQuery.createUploadIframe(id, s.secureuri);
    Big Moxy, Dec 22, 2007
    #1
    1. Advertising

  2. On Dec 21, 4:17 pm, Big Moxy <> wrote:

    [snip regarding jQuery plugin]

    Most of the regular contributors to comp.lang.javascript recommend
    against using big general purpose libraries like jQuery and Prototype.
    If you search the group archives you will see many posts that question
    the quality of the code. However if you are locked in then questions
    specific to jQuery will likely receive better answers from the jQuery
    group.

    http://docs.jquery.com/Discussion

    Peter
    Peter Michaux, Dec 22, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PilotYid
    Replies:
    1
    Views:
    597
    Andrew Thompson
    Oct 31, 2005
  2. Marcin Cenkier
    Replies:
    1
    Views:
    5,380
    Marcin Cenkier
    Apr 12, 2006
  3. Jimmy
    Replies:
    0
    Views:
    489
    Jimmy
    Mar 15, 2007
  4. Aaron Gray
    Replies:
    20
    Views:
    368
    Lasse Reichstein Nielsen
    Jul 27, 2008
  5. lorlarz
    Replies:
    6
    Views:
    203
    David Mark
    Mar 25, 2010
Loading...

Share This Page