国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
759B

  1. <script>
  2. $(document).ready(function () {
  3. $("#btnUploadLitpic").click(function(){
  4. $("#iptLitpic").click();
  5. })
  6. $("#iptLitpic").change(function (val) {
  7. var formData = new FormData();
  8. var fileData = $('#iptLitpic')[0].files[0];
  9. formData.append('file', fileData);
  10. $.ajax({
  11. url: '<?php echo $cfg_cmsurl;?>/user/api.php?action=upload&type=litpic',
  12. type: 'POST',
  13. data: formData,
  14. processData: false,
  15. contentType: false,
  16. success: function (result) {
  17. if (result.code === 0) {
  18. $("#imgLitpic").attr('src', result.data);
  19. $("#litpic").val(result.data);
  20. }
  21. },
  22. error: function (xhr, status, error) {
  23. ShowMsg("文件上传失败");//处理上传失败后的回调
  24. }
  25. });
  26. });
  27. });
  28. </script>