javascript 如何将文件从 iOS 上传到我的网站?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10662137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 10:37:33  来源:igfitidea点击:

How do I upload a file from iOS to my website?

javascriptiosuploadwebzk

提问by Kiloku

I have a website that receives files from the user, using the "Choose file" interface for the OS they're on. This worked for me on Windows, Mac and Linux, but not on iOS. When I click the button that should load the interface, nothing happens. I guess I have to do it in a specific way for iOS. We're using the ZK framework to develop the website, but if you know how to do the upload in some other way, please tell me.

我有一个网站从用户那里接收文件,使用他们所在操作系统的“选择文件”界面。这在 Windows、Mac 和 Linux 上对我有用,但在 iOS 上不起作用。当我单击应该加载界面的按钮时,没有任何反应。我想我必须以特定的方式为 iOS 做到这一点。我们正在使用ZK框架开发网站,但如果您知道如何通过其他方式进行上传,请告诉我。

回答by Chagemei

Up to iOS version 5.X, there is no possibility to upload a file via an html input tag. You would have to create a native App based on PhoneGap/Cordova to have the ability to create images/videos to be uploaded. But that's quite some effort to do. You should definitely think about the following option:

在 iOS 5.X 版本之前,无法通过 html 输入标签上传文件。您必须创建基于 PhoneGap/Cordova 的本机应用程序才能创建要上传的图像/视频。但这需要相当多的努力。您绝对应该考虑以下选项:

Since iOS version 6.0 Apple has added support for input type file elements. See more details on that here: http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers

从 iOS 6.0 版本开始,Apple 增加了对输入类型文件元素的支持。在此处查看更多详细信息:http: //www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers

This way seems to be appropriate, since the adoption rate of iOS 6 is quite high right now (nearly 80%): http://david-smith.org/iosversionstats/

这种方式似乎很合适,因为 iOS 6 现在的采用率相当高(接近 80%):http: //david-smith.org/iosversionstats/