收藏
回答

小程序uploadFile上传

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug uploadFile 客户端 7.0.3 2.0.0




如上图,小文件可以正常上传请求到后台接口。   当文件是5兆的时候就一直pending,请求不到后台,后台大小已做处理。


回答关注问题邀请回答
收藏

5 个回答

  • 李安志
    李安志
    2021-04-14

    请教一下,我上传文件时,上传不到服务器,始终返回下面结果,是什么原因

    <!DOCTYPE html>

    <html>

    <head>

        <meta charset="UTF-8">

        <title>系统发生错误</title>

        <meta name="robots" content="noindex,nofollow" />

        <style>

            /* Base */

            body {

                color: #333;

                font: 16px Verdana, "Helvetica Neue", helvetica, Arial, 'Microsoft YaHei', sans-serif;

                margin: 0;

                padding: 0 20px 20px;

            }

            h1{

                margin: 10px 0 0;

                font-size: 28px;

                font-weight: 500;

                line-height: 32px;

            }

            h2{

                color: #4288ce;

                font-weight: 400;

                padding: 6px 0;

                margin: 6px 0 0;

                font-size: 18px;

                border-bottom: 1px solid #eee;

            }

            h3{

                margin: 12px;

                font-size: 16px;

                font-weight: bold;

            }

            abbr{

                cursor: help;

                text-decoration: underline;

                text-decoration-style: dotted;

            }

            a{

                color: #868686;

                cursor: pointer;

            }

            a:hover{

                text-decoration: underline;

            }

            .line-error{

                background: #f8cbcb;

            }


            .echo table {

                width: 100%;

            }


            .echo pre {

                padding: 16px;

                overflow: auto;

                font-size: 85%;

                line-height: 1.45;

                background-color: #f7f7f7;

                border: 0;

                border-radius: 3px;

                font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;

            }


            .echo pre > pre {

                padding: 0;

                margin: 0;

            }

        

            /* Exception Info */

            .exception {

                margin-top: 20px;

            }

            .exception .message{

                padding: 12px;

                border: 1px solid #ddd;

                border-bottom: 0 none;

                line-height: 18px;

                font-size:16px;

                border-top-left-radius: 4px;

                border-top-right-radius: 4px;

                font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";

            }


            .exception .code{

                float: left;

                text-align: center;

                color: #fff;

                margin-right: 12px;

                padding: 16px;

                border-radius: 4px;

                background: #999;

            }

            .exception .source-code{

                padding: 6px;

                border: 1px solid #ddd;


                background: #f9f9f9;

                overflow-x: auto;


            }

            .exception .source-code pre{

                margin: 0;

            }

            .exception .source-code pre ol{

                margin: 0;

                color: #4288ce;

                display: inline-block;

                min-width: 100%;

                box-sizing: border-box;

            font-size:14px;

                font-family: "Century Gothic",Consolas,"Liberation Mono",Courier,Verdana;

                padding-left: 56px;

            }

            .exception .source-code pre li{

                border-left: 1px solid #ddd;

                height: 18px;

                line-height: 18px;

            }

            .exception .source-code pre code{

                color: #333;

                height: 100%;

                display: inline-block;

                border-left: 1px solid #fff;

            font-size:14px;

                font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";

            }

            .exception .trace{

                padding: 6px;

                border: 1px solid #ddd;

                border-top: 0 none;

                line-height: 16px;

            font-size:14px;

                font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";

            }

            .exception .trace ol{

                margin: 12px;

            }

            .exception .trace ol li{

                padding: 2px 4px;

            }

            .exception div:last-child{

                border-bottom-left-radius: 4px;

                border-bottom-right-radius: 4px;

            }


            /* Exception Variables */

            .exception-var table{

                width: 100%;

                margin: 12px 0;

                box-sizing: border-box;

                table-layout:fixed;

                word-wrap:break-word;            

            }

            .exception-var table caption{

                text-align: left;

                font-size: 16px;

                font-weight: bold;

                padding: 6px 0;

            }

            .exception-var table caption small{

                font-weight: 300;

                display: inline-block;

                margin-left: 10px;

                color: #ccc;

            }

            .exception-var table tbody{

                font-size: 13px;

                font-family: Consolas,"Liberation Mono",Courier,"微软雅黑";

            }

            .exception-var table td{

                padding: 0 6px;

                vertical-align: top;

                word-break: break-all;

            }

            .exception-var table td:first-child{

                width: 28%;

                font-weight: bold;

                white-space: nowrap;

            }

            .exception-var table td pre{

                margin: 0;

            }


            /* Copyright Info */

            .copyright{


    2021-04-14
    有用 1
    回复
  • 禾店科技
    禾店科技
    2021-05-08

    小程序sdk不适用,走uploadfile,post表单方式

    2021-05-08
    有用
    回复
  • 前端 苏栋爱
    前端 苏栋爱
    2019-07-31

    同样的问题,我上传的图片大小是8k,在微信小程序模拟器中可以上传,在苹果手机微信小程序就不可以,接口一直是pending

    2019-07-31
    有用
    回复
  • Paul
    Paul
    2019-04-03

    目前小程序的uploadFile上传接口不支持分片上传,只能整个文件单片上传,所以上传大文件时容易导致一直pending状态。


    2019-04-03
    有用
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2019-04-03

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2019-04-03
    有用
    回复
登录 后发表内容