<tfoot id='f9kS0'></tfoot>

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

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

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

    1. <legend id='f9kS0'><style id='f9kS0'><dir id='f9kS0'><q id='f9kS0'></q></dir></style></legend>
    2. IONIC 3 IOS 无法从文件中读取数据

      时间:2024-04-14

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

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

            1. <tfoot id='fmJLf'></tfoot>
            2. <legend id='fmJLf'><style id='fmJLf'><dir id='fmJLf'><q id='fmJLf'></q></dir></style></legend>

                <tbody id='fmJLf'></tbody>
              • <bdo id='fmJLf'></bdo><ul id='fmJLf'></ul>
                本文介绍了IONIC 3 IOS 无法从文件中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用此文件选择器将文件上传到我的服务器:

                I am using this file picker to upload files to my server:

                https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin

                我的服务器采用base64文件,所以我需要转换我上传的文件.我正在使用离子文档中提到的文件插件来做到这一点.所以我的代码如下所示:

                My server takes base64 files, so I need to convert the file I uploaded. I am doing that using the file plugin mentioned in the ionic docs. So my code looks like this:

                uploadIOS(){
                    var self=this
                
                    let utis = ["public.data"]
                
                    FilePicker.pickFile(
                        function (uri) {
                            let correctPath = uri.substr(0, uri.lastIndexOf('/') + 1);
                            let currentName = uri.substring(uri.lastIndexOf('/') + 1);
                
                            self.file.readAsDataURL(correctPath, currentName).then(result=>{
                                    console.log ('reading data ' + JSON.stringify(result))
                                }).catch((err)=>{
                                    console.log ('err4' + JSON.stringify(err))
                                })
                        },
                        function (error) {
                            console.log(JSON.stringify(error));
                        },
                        function (utis) {
                            console.log('UTIS', this.utis)
                        }
                    )
                }
                

                但是当我从 Google Drive、iCloud Drive 或 DropBox 上传时,它会返回

                but when I upload from Google Drive, or iCloud Drive or DropBox it returns

                {"code":5,"message":"ENCODING_ERR"}

                {"code":5,"message":"ENCODING_ERR"}

                推荐答案

                let self = this;
                self.filePicker.pickFile().then(uri => {
                
                let correctPath = uri.substr(0, uri.lastIndexOf('/') + 1);
                let currentName = uri.substring(uri.lastIndexOf('/') + 1);
                self.file.readAsDataURL("file:///" + correctPath, currentName).then(result=>{                           
                
                
                })
                

                我已使用此代码解决了此问题.

                I have fixed this issue using this code.

                这篇关于IONIC 3 IOS 无法从文件中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Ionic 3:使用手机的后退按钮关闭模式 下一篇:使用 Ionic 3 将文件保存到下载目录

                相关文章

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

                <legend id='YkvjT'><style id='YkvjT'><dir id='YkvjT'><q id='YkvjT'></q></dir></style></legend>
                  1. <tfoot id='YkvjT'></tfoot>
                    • <bdo id='YkvjT'></bdo><ul id='YkvjT'></ul>

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