Html 用于移动 Safari 的 html5 Web 应用程序,可从 Photos.app 上传图像?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3891831/
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-08-29 04:47:41  来源:igfitidea点击:

A html5 web app for mobile safari to upload images from the Photos.app?

iphonehtmlfile-uploadiosmobile-safari

提问by Abhic

Is it possible to write a HTML5 web application designed for the iOS devices (iPad, iPhone, iPod Touch) which can allow the user to upload an image from the filesystem?

是否可以编写一个专为 iOS 设备(iPad、iPhone、iPod Touch)设计的 HTML5 Web 应用程序,允许用户从文件系统上传图像?

Imagine uploading a new photo to your twitter avatar via a web app.

想象一下通过 Web 应用程序将新照片上传到您的推特头像。

回答by Alexandre

UPDATE:iOs 6 Safari is going to support upload videos and images from the Photo Library.

更新:iOS 6 Safari 将支持从照片库上传视频和图像。

====

====

I hate this word, but, it's impossible(up now). Here is the reasons:

我讨厌这个词,但是,这是不可能的(现在)。原因如下:

1) mobile safari doesn't support upload anything.

1) mobile safari 不支持上传任何东西。

2) mobile safari can't access ios components (actually it can, but, only through phonegap)

2)mobile safari无法访问ios组件(实际上可以,但是,只能通过phonegap

回答by Josh

another way to approach this problem would be to give users a private email address that they can email their photos to for automatic upload (eg. [email protected]).

解决此问题的另一种方法是为用户提供一个私人电子邮件地址,他们可以将照片通过电子邮件发送到自动上传(例如,[email protected])。

A little more work to set up, but will give a consistent experience for users on all devices (and non-mobile users might find it convenient too).

需要做更多的设置工作,但将为所有设备上的用户提供一致的体验(非移动用户也可能会觉得很方便)。

回答by Joa

I like the picup solution at http://picupapp.com

我喜欢http://picupapp.com 上的 picup 解决方案

回答by EnriqueL

I found an acceptable work around for this. Add a mailTo link on the page with predefined instructions which shows the user how to copy paste an image from his camera roll into the email. Then, write a job/script that listens to that inbox for inbound emails, strip the image and process accordingly.

我为此找到了一个可以接受的解决方法。在页面上添加一个带有预定义说明的 mailTo 链接,该链接向用户展示如何将图像从他的相机胶卷复制粘贴到电子邮件中。然后,编写一个作业/脚本来侦听该收件箱中的入站电子邮件,剥离图像并进行相应的处理。

It's not perfect, but they click the link from safari and then only need to go to photos, copy and come back to your app. After trying it on my phone, it's more than an acceptable work around that allows me to move forward without writing an App.

这并不完美,但他们点击来自 safari 的链接,然后只需要转到照片,复制并返回到您的应用程序。在我的手机上尝试之后,这不仅仅是一个可以接受的工作,它允许我在不编写应用程序的情况下继续前进。

    <div data-role="collapsible" data-collapsed="true" id="uploadPicContainer" data-theme="d">
    <h3>{l t='Upload Picture'}</h3>
    <a href="mailto:[email protected]?subject={l t='My pictures of'} {$var_biz.bizname}[{$var_biz.id}]!&body={l t='To upload a picture go to your Camera Roll and copy paste an image to this area in the email.  We will apply your picture after review!'}">{l t='Click here to upload pictures of'} {$var_biz.bizname}</a>
</div>

回答by milan

You will be able to upload photos using safari in iOS 6 onwards. Although the above workarounds will still be neccesary for iOS 5 and below.

您将能够在 iOS 6 及更高版本中使用 safari 上传照片。尽管上述解决方法对于 iOS 5 及更低版本仍然是必要的。

回答by Ian Dunn

Another native iOS application (similar to Picup or iphone-photo-picker) is Aurigma Up.

另一个原生 iOS 应用程序(类似于 Picup 或 iphone-photo-picker)是Aurigma Up

回答by Octavian Naicu

Safari on iOS 6.0is the 1st to add support for <input type="file">by allowing you to:

iOS 6.0上的Safari是第一个添加支持的,<input type="file">它允许您:

  • take a new video or photo
  • select a video or photo from the library
  • 拍摄新视频或照片
  • 从库中选择视频或照片

Here's how it looks on iOS10:

这是它在 iOS10 上的样子:

iOS 10 file input no filter

iOS 10 文件输入无过滤器

iOS9 introduced iCloud Driveand Moreoptions including Dropbox. iOS 6 through 8 had only the 1st two options.

iOS9 引入了iCloud Drive更多选项,包括 Dropbox。iOS 6 到 8 只有第一个两个选项。

You can limit the file types to just photos by using the accept="image/*"attribute:

您可以使用以下accept="image/*"属性将文件类型限制为照片:

<input type="file" accept="image/*" >will limit the options to just photos:

<input type="file" accept="image/*" >将选项仅限于照片:

iOS 10 file input for photos

iOS 10 照片文件输入

On the Android side Android 2.2+is the 1st to support the above code.

在 Android 方面,Android 2.2+是第一个支持上述代码的。

Disclaimer: image courtesy of Pipewhich handles video recording where I am CTO

免责声明:图片由Pipe提供,我是 CTO,负责处理视频录制

回答by Thymine

An idea I just thought of is to have a textbox that the user could paste a url into, allowing the user to use dropbox or a similar app and copy a public url of the dropbox file. Then the server would be able to download from the dropbox server.

我刚刚想到的一个想法是有一个文本框,用户可以将 url 粘贴到其中,允许用户使用 dropbox 或类似的应用程序并复制 dropbox 文件的公共 url。然后服务器将能够从保管箱服务器下载。

I need to support filetypes other than images so it sounds like picupapp won't work for me.

我需要支持图像以外的文件类型,所以听起来 picupapp 对我不起作用。

回答by Piotr Justyna

If you're still using iOS5, please consider using iCabMobile. Got it for my ipad and (at least for me) file upload works fine.

如果您仍在使用 iOS5,请考虑使用iCabMobile。为我的 ipad 准备了它,(至少对我而言)文件上传工作正常。

Regards, Piotr

问候, 彼得

回答by Erdal G.

Only for iOS >= 6

仅适用于 iOS >= 6

<input type="file" accept="image/*" capture>

<input type="file" accept="image/*" capture>

"capture" doesn't change anything with iOS but it's still useful for other devices (apparently Androids, see comments).

“捕获”不会改变 iOS 的任何内容,但它对其他设备仍然有用(显然是 Android,请参阅评论)。