api-uploadify.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. **************************
  3. (C)2010-2013 phpMyWind.com
  4. update: 2012-4-27 11:35:55
  5. person: Feng
  6. **************************
  7. */
  8. /*
  9. * 获取上传窗口函数
  10. *
  11. * @access public
  12. * @path string 网站主地址
  13. * @frame string 调用iframeID
  14. * @title string 弹出窗口标题
  15. * @type string 可上传文件类型,可以是直接的类型或是image|soft|media
  16. * @dir string 可上传文件夹
  17. * @num string 可上传数量
  18. * @size string 可上传文件大小
  19. * @input string 处理后返回值写入input 或 内容区域
  20. * @func string 自定义回调函数
  21. */
  22. function GetUploadify(path,frame,title,type,dir,num,size,input,func)
  23. {
  24. var iframe_str='<iframe frameborder="0" ';
  25. iframe_str=iframe_str+'id="'+frame+'" ';
  26. iframe_str=iframe_str+'src="'+path+'/api/uploadify/upload/';
  27. iframe_str=iframe_str+title+'/'+type+'/'+dir+'/'+num+'/'+size+'/'+frame+'/'+input+'/'+func+'"';
  28. iframe_str=iframe_str+'allowtransparency="true" class="uploadframe" scrolling="no">';
  29. iframe_str=iframe_str+'</iframe>';
  30. $("body").append(iframe_str);
  31. $("iframe.uploadframe").css("height",$(document).height()).css("width","100%").css("position","absolute").css("left","0px").css("top","0px").css("z-index","999999").show();
  32. $(window).resize(function(){
  33. $("iframe.uploadframe").css("height",$(document).height()).show();
  34. });
  35. }
  36. /*
  37. * 删除组图input
  38. *
  39. * @access public
  40. * @val string 删除的图片input
  41. */
  42. function ClearPicArr(val,path)
  43. {
  44. $("li[rel='"+ val +"']").remove();
  45. $.get(
  46. path+'/api/uploadify/delupload/',
  47. {action:"del", filename:val},
  48. function(){}
  49. );
  50. }