designersvsoft
designersvsoft

Reputation: 1859

Jquery ajax uploader with query string

I used the following plugin for upload progress bar

http://blog.stevensanderson.com/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/

jQuery(document).ready( function () { 
         $(".flupload").makeAsyncUploader({
        upload_url: "upload_logo_file.php?pid="+($(this).attr("id")), 
        flash_url: 'swfupload.swf',
        button_image_url: 'blankButton.png'
    });

    });

In my html form i used the floowing

<input type="file" id="1550" name="1550" class="flupload" />
<input type="file" id="1552" name="1552" class="flupload" />

The upload progress bar is working fine here. But my problem is: i want to pass the id (1550 or 1552) with the 'Upload_url' parameter.

For this used the following

upload_url: "upload_logo_file.php?pid="+($(this).attr("id")), 

But the Id is not retrieved here while using ($(this).attr("id"))

How to get the current id here.

Please help.

Upvotes: 0

Views: 275

Answers (1)

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120937

Your ids are not valid html ids. Use a custom data attribute instead, like so:

<input type="file" data-id="1550" name="1550" class="flupload" />

and

upload_url: "upload_logo_file.php?pid="+$(this).data("id"),

Upvotes: 1

Related Questions