<bdo id='NWKmA'></bdo><ul id='NWKmA'></ul>

    <legend id='NWKmA'><style id='NWKmA'><dir id='NWKmA'><q id='NWKmA'></q></dir></style></legend>

    1. <small id='NWKmA'></small><noframes id='NWKmA'>

    2. <i id='NWKmA'><tr id='NWKmA'><dt id='NWKmA'><q id='NWKmA'><span id='NWKmA'><b id='NWKmA'><form id='NWKmA'><ins id='NWKmA'></ins><ul id='NWKmA'></ul><sub id='NWKmA'></sub></form><legend id='NWKmA'></legend><bdo id='NWKmA'><pre id='NWKmA'><center id='NWKmA'></center></pre></bdo></b><th id='NWKmA'></th></span></q></dt></tr></i><div id='NWKmA'><tfoot id='NWKmA'></tfoot><dl id='NWKmA'><fieldset id='NWKmA'></fieldset></dl></div>
    3. <tfoot id='NWKmA'></tfoot>

      Blueimp jQuery 文件上传插件——“空文件上传"结果 PHP

      时间:2023-12-01
        <tbody id='Pq9Zo'></tbody>

    4. <i id='Pq9Zo'><tr id='Pq9Zo'><dt id='Pq9Zo'><q id='Pq9Zo'><span id='Pq9Zo'><b id='Pq9Zo'><form id='Pq9Zo'><ins id='Pq9Zo'></ins><ul id='Pq9Zo'></ul><sub id='Pq9Zo'></sub></form><legend id='Pq9Zo'></legend><bdo id='Pq9Zo'><pre id='Pq9Zo'><center id='Pq9Zo'></center></pre></bdo></b><th id='Pq9Zo'></th></span></q></dt></tr></i><div id='Pq9Zo'><tfoot id='Pq9Zo'></tfoot><dl id='Pq9Zo'><fieldset id='Pq9Zo'></fieldset></dl></div>
          <bdo id='Pq9Zo'></bdo><ul id='Pq9Zo'></ul>
          <tfoot id='Pq9Zo'></tfoot>
              1. <legend id='Pq9Zo'><style id='Pq9Zo'><dir id='Pq9Zo'><q id='Pq9Zo'></q></dir></style></legend>

              2. <small id='Pq9Zo'></small><noframes id='Pq9Zo'>

                本文介绍了Blueimp jQuery 文件上传插件——“空文件上传"结果 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这是插件:https://github.com/blueimp/jQuery-File-Uploadp>

                上传文件后,我无法从插件获取我想要的响应.

                在带有插件的页面上,我有以下内容

                $('#fileupload').fileupload('选项',{'maxNumberOfFiles' :1,网址":/admin/upload_handler.php"});

                upload_handler.php 中,我成功地从 $_FILES 检索上传的文件并执行操作,然后以 JSON 格式发回响应.我已使用 Firebug 确认响应格式正确:

                <代码>[{url":image_url",thumbnail_url":image_th_url",delete_url":测试",删除类型":删除",名称":foobar.jpg",尺寸":7419}]

                但是回调找不到文件数组,我得到错误:'空文件上传结果'.我觉得我在这里遗漏了一些重要的东西——我在文档、论坛或 Stack Overflow 中找不到任何东西.感谢您的帮助.

                解决方案

                从插件版本5开始,json响应发生了变化:https://github.com/blueimp/jQuery-File-Upload/wiki/JSON-Response

                所以你只需要调整你的上传类:

                $filejson = new stdClass();$filejson->files[] = $fileArray;返回 json_encode($filejson);

                你已经完成了

                Here's the plugin: https://github.com/blueimp/jQuery-File-Upload

                I'm having a problem getting the response I want from the plugin after uploading a file.

                On the page with the plugin, I have the following

                $('#fileupload').fileupload(
                    'option',
                    {
                        'maxNumberOfFiles' :1,
                        'url' : '/admin/upload_handler.php'
                    }
                );
                

                In upload_handler.php I successfully retrieve the uploaded files from $_FILES and do stuff, then send a response back in JSON. I've confirmed using Firebug that the response is in the proper format:

                [ 
                    {                
                        "url" : "image_url",
                        "thumbnail_url" : "image_th_url",
                         "delete_url" : "test",
                         "delete_type" : "DELETE",
                         "name" : "foobar.jpg",
                         "size" : 7419
                     }
                ]
                

                But the callback can't find the files array, and I get the error: 'Empty file upload result'. I feel like I'm missing something crucial here--I can't find anything in the docs, forums, or Stack Overflow. I appreciate any help.

                解决方案

                Since the version 5 of the plugin, the json response has changed: https://github.com/blueimp/jQuery-File-Upload/wiki/JSON-Response

                So you just have tweak your upload class with:

                $filejson = new stdClass();
                $filejson->files[] = $fileArray;
                return json_encode($filejson);
                

                And you're done

                这篇关于Blueimp jQuery 文件上传插件——“空文件上传"结果 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:JQuery Knob显示数字变化 下一篇:使用 PHP foreach 代码填充日历

                相关文章

                <i id='QVWB2'><tr id='QVWB2'><dt id='QVWB2'><q id='QVWB2'><span id='QVWB2'><b id='QVWB2'><form id='QVWB2'><ins id='QVWB2'></ins><ul id='QVWB2'></ul><sub id='QVWB2'></sub></form><legend id='QVWB2'></legend><bdo id='QVWB2'><pre id='QVWB2'><center id='QVWB2'></center></pre></bdo></b><th id='QVWB2'></th></span></q></dt></tr></i><div id='QVWB2'><tfoot id='QVWB2'></tfoot><dl id='QVWB2'><fieldset id='QVWB2'></fieldset></dl></div>
              3. <tfoot id='QVWB2'></tfoot>

                  • <bdo id='QVWB2'></bdo><ul id='QVWB2'></ul>

                    <small id='QVWB2'></small><noframes id='QVWB2'>

                    <legend id='QVWB2'><style id='QVWB2'><dir id='QVWB2'><q id='QVWB2'></q></dir></style></legend>