我有一个带有uploadify按钮的文件,但它本身可以正常工作。
但是,我有一个父文件,使用uploadify调用该文件并将其显示在div中。这不起作用。有没有办法在进行ajax调用时初始化uploadifier
感谢
编辑 对不起家伙
好的抱歉..
我有一个名为Browse Files ..的链接
<a rel="button" href="index.cfm?action=File_Manager>Browse Files</a><div id="_browse_resource_image" class="gallery_container"></div>
这将在_browse_resource_image div中加载我的文件管理器。文件管理器允许用户查看服务器上的文件并导航到文件夹并选择文件等。文件管理器内部是上传按钮,这将允许用户将文件上传到用户当前所在的目录。希望有意义吗?
$(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'
});
});
文件夹是问题,如果它在ajax之外我需要使用JS但是我可以使用coldfusion。
答案 0 :(得分:0)
如何加载包含uploadify的部分内容?因为你正在使用jquery,你可能正在使用jQuery.get http://api.jquery.com/jQuery.get/来进行这个ajax调用。
如果是这种情况,则必须在回调函数中初始化上传者
来自jQuery Doc的示例
$.get('ajax/test.html', function(data) {
alert('Load was performed.');
//your init code
});
答案 1 :(得分:0)
<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>
使用livequery做了诀窍
欢呼声