<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 无法从文件中读取数据

      IONIC 3 IOS can#39;t read data from file(IONIC 3 IOS 无法从文件中读取数据)

          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 无法从文件中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)
                Automatically copy property values from one object to another of a different type but the same protocol (Objective-C)(自动将属性值从一个对象复制到另一个类型不同但协议相同的对象 (Objective-C))
                Copy text to clipboard with iOS(使用 iOS 将文本复制到剪贴板)
                How to copy text to clipboard/pasteboard with Swift(如何使用 Swift 将文本复制到剪贴板/粘贴板)
                How to show the progress of copying a large file in iOS?(如何在iOS中显示复制大文件的进度?)
                    <tbody id='YkvjT'></tbody>

                • <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'>