I am using Jquery Uploadify for images upload with PHP, here i have multiple instances of uploadify and and each instance is uploading images in different folders.
I want to second instance of uploadify will start uploading images only after first instance of uploadify uploaded selected image.
$('#listing_image').uploadifySettings('folder','listing_image_TempImage'); $('#listing_image').uploadifyUpload(); $('#listing_image1').uploadifySettings('folder','listing_image1_TempImage'); $('#listing_image1').uploadifyUpload();
i.e 'listing_image1' will get call when processing of 'listing_image' will be completed. How can I achieve this behavior?
I cant add a comment to you'r answer yet. So i'm writing it here instead.
Try to make one upload work by using this (make sure the links point's to the correct locations):
$('#listing_image').uploadify({
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
'folder' : '/listing_image_TempImage',
onComplete: function(){
// Do oncomplete stuff.
}
});
When you can get that to work, then you should be able to make this work.
var uploads = [2,4,5]; // Only number 2,4 and 5
var numberofuploads = uploads.length; // How many is that?
var folderlist = [0, '/folder1', '/folder2', '/folder3', '/folder4', '/folder5', '/folder6']; // List of folders to upload to
var listingimageslist = [0, '#listing_image1', '#listing_image2', '#listing_image3', '#listing_image4', '#listing_image5', '#listing_image6']; // List of form selectors.
var folder = folderlist[uploads[0]]; // What folder should this form upload to
var listingimages = listingimageslist[uploads[0]]; // With what selector can the form be found?
if (numberofuploads > 1)
{
var next = 1; // What upload to initiate after this one?
}
initUpload(listingimages,folder); // make the upload thing work.
function initUpload(e,folder)
{
$(e).uploadify({
'folder' : folder,
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
onComplete: function(){
var folder = folderlist[uploads[next]];
var listingimages = listingimageslist[uploads[next]];
next++
if (numberofuploads != next)
{
initUpload(listingimages,folder);
}
}
});
};
I didn't test the code, but you should be able to make it work if you know a bit of javascript.
Remenber to have all your jQuery code in a $(document).ready like this:
$(document).ready(function() {
// Insert code here
});