zoukankan      html  css  js  c++  java
  • 微信图片上传

    我只想说被坑的完全无语了,感谢万能的网友

    function chooseImage() {
                wx.chooseImage({
                    count: 1, // 默认9
                    sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
                    success: function (res) {
                        images.localId = res.localIds;
                        uploadImage(res.localIds.toString());
                        jQuery(function () {
                            $("#upImages").append('<li class="weui_uploader_file"><img src="' + res.localIds + '" style="79px; height:79px;"/></li>');
                        });
                    }
                });
            }
    
            function uploadImage(resId) {
                wx.uploadImage({
                    localId: resId,
                    success: function (res) {
                        downloadImage(res.serverId);
                    },
                    fail: function (res) {
                        alert(JSON.stringify(res));
                    }
                });
            }
            function downloadImage(serverId) {
                $.ajax({
                    url: 'handlers/StudentHandlers.ashx?action=downImage',
                    data: {
                        mediaId: serverId
                    },
                    success: function (result) {
                        alert(result);
                    }
                });
            }
    

      在uploadimage的时候一直没有反应,就是不上传图片,感谢万能的网友们

    res.localIds.toString()
    res.localIds.toString()
    res.localIds.toString() 重要的事情说三遍,这里要加上toString()

    真正的认识自己,才能做好自己,做好自己,才能做好你将会做的每一件事。
  • 相关阅读:
    6th Alpha阶段的postmortem报告
    两种open()函数
    文件操作权限第一位的0是什么意思
    vi的查找与替换
    浅析Linux下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc文件
    Linux命令总结:file
    Linux下/boot目录
    英语单词简记
    Linux下grep命令
    Linux下find命令
  • 原文地址:https://www.cnblogs.com/encore620/p/5620307.html
Copyright © 2011-2022 走看看