views:

30

answers:

2

Hi there.

I have a file with the uploadify button that works fine but itself.

However, i have a parent file that calls the file with uploadify and displays it in a div. This doesnt work. Is there a way to initialise the uploadifier when the ajax call is made

thanks

edit Sorry guys

OK Sorry..

I have a link called Browse Files..

<a rel="button" href="index.cfm?action=File_Manager>Browse Files</a><div id="_browse_resource_image" class="gallery_container"></div> 

This loads my file manager in _browse_resource_image div.. The File manager allows the user to view files on the server and navigate into folders and select files etc.. inside the file manager is the upload button, that will allow the user to upload files to the directory the user is currently in.. Hope that makes sense?

$(document).ready(function() {
$("##fileInput1").uploadify({
    'uploader'       : '../assets/js/uploadify.swf',
    'script'         : 'file_manager/upload.cfm',
    'cancelImg'      : 'file_manager/cancel.png',
    'multi'          : true,
    'buttonImg'      : '../assets/img/upload.gif',
    'auto'           : 'true',
    'height'         : '23',
        'folder'     : $("##_browse_resource_image_path").val(),
    'fileDesc'       : 'All Images and Documents Only',
    'fileExt'        : '*.jpg;*.jpeg;*.png;*.gif;*.pdf;*.doc;*.docx'

});

});

Folder is the problem, if its outside the ajax i need to use JS butinside i can use coldfusion.

A: 

how are you loading the partial content which contains the uploadify? as you are using jquery its likely that you are using jQuery.get http://api.jquery.com/jQuery.get/ to make this ajax call.

if this is the case you have to initialize the uploadifier in the callback function

example from jQuery Doc

$.get('ajax/test.html', function(data) {
        alert('Load was performed.');
        //your init code
});
marc.d
A: 
<script type="text/javascript">

$('##fileInput1').livequery(function(){
     $(this).uploadify({
        'uploader'       : '../assets/js/uploadify.swf',
        'script'         : 'file_manager/upload.cfm',
        'cancelImg'      : 'file_manager/cancel.png',
        'multi'          : true,
        'buttonImg'      : '../assets/img/upload.gif',
        'auto'           : 'true',
        'height'         : '23',
        'folder'         : $("##_browse_resource_image_path").val(),
        'fileDesc'       : 'All Images and Documents Only',
        'fileExt'        : '*.jpg;*.jpeg;*.png;*.gif;*.pdf;*.doc;*.docx'
    });
});
</script>

using livequery did the trick

cheers

Alessandro