upload.rst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. 上传文件
  2. ========================================================
  3. KindEditor默认提供ASP、ASP.NET、PHP、JSP上传程序,这些程序是演示程序,建议不要直接在实际项目中使用。
  4. 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
  5. 选择程序语言
  6. -----------------------------------------------------------------
  7. .. sourcecode:: js
  8. // ASP
  9. KindEditor.ready(function(K) {
  10. K.create('#textarea_id', {
  11. uploadJson : '../asp/upload_json.asp',
  12. fileManagerJson : '../asp/file_manager_json.asp',
  13. allowFileManager : true
  14. });
  15. });
  16. // ASP.NET
  17. KindEditor.ready(function(K) {
  18. K.create('#textarea_id', {
  19. uploadJson : '../asp.net/upload_json.ashx',
  20. fileManagerJson : '../asp.net/file_manager_json.ashx',
  21. allowFileManager : true
  22. });
  23. });
  24. // JSP
  25. KindEditor.ready(function(K) {
  26. K.create('#textarea_id', {
  27. uploadJson : '../jsp/upload_json.jsp',
  28. fileManagerJson : '../jsp/file_manager_json.jsp',
  29. allowFileManager : true
  30. });
  31. });
  32. .. note::
  33. 具体使用方法请参见各语言(asp、asp.net、php、jsp)目录下的demo.xxx文件。
  34. POST参数
  35. -----------------------------------------------------------------
  36. * imgFile: 文件form名称
  37. * dir: 上传类型,分别为image、flash、media、file
  38. 返回格式(JSON)
  39. -----------------------------------------------------------------
  40. .. sourcecode:: js
  41. //成功时
  42. {
  43. "error" : 0,
  44. "url" : "http://www.example.com/path/to/file.ext"
  45. }
  46. //失败时
  47. {
  48. "error" : 1,
  49. "message" : "错误信息"
  50. }