SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Uploadify with dynamic div

    Hi,
    I'm having trouble with uploadify on a dynamic form. It works fine, but not for the dynamic divs. Basically, I have a tree which when clicked, _ajax.php will do the following:
    Code JavaScript:
    case 'details':
     
               $cats = new Products();
                                           $parent = $_GET['parent'];
                                           if($parent){
                                                   $q = MYSQL_QUERY...;
                                                   $result = $cats->query($q);
                                                   $data = $cats->getParentCatsResult($parent);
                                                   BLAH BLAH BLAH...
                                                   echo '<div id="catDetails"><div id=<div style="height: 200px; margin-bottom: 10px; padding:10px; overflow: auto; width: 390px; border: 1px solid #e25e00;" id="queue"></div>
    <input id="file_upload-'.$parent.'" name="file_upload" type="file" /></div>';
                                           }
                                           else {
     
                                           }
     
                                           break;

    On the page with the tree I have (amongst all the right includes):
    Code HTML4Strict:
    <script type="text/javascript">
    $(document).find("a[id^='details-']").live('click', function(){
                var num = this.id.split('-')[1];
    alert(\"Num: " + num); //WORKING...
    $('#file_upload1-' + num).uploadify({
        'uploader'   : 'uploadify/uploadify.swf',
        'script'     : 'uploadify/upload.php',
        'cancelImg' : 'uploadify/cancel.png',
        'folder'     : '../images/montage/',
    	'fileExt'   : '*.jpg;*.gif;*.png',
    	'fileDesc'   : 'Image Files',
    	'removeCompleted' : false,
    	'multi'     : false,
        'auto'       : true,
    	'queueID'         : 'queue',
    	'simUploadLimit' : 1
     
          });
     
    });
    </script>
     
    //With the links to load the catDetails being:
    <a href="#" class="draggable" id="details-1">Click this and you can upload a file for id "1"</a>

    Any help would be appreciated. Uploadify works fine if I just stick a form on that page, but not for the dynamic div. Hence my attempt at jquery to load Uploadify for the div and not onLoad.

    Cheers,
    Rhys

  2. #2
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorted it, just wrote a function to call uploadify, and called the function after the div.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •