文件 API:Blob.slice - 从开始处切片,还是开始后的字节?
有一个有趣的问题,但我找不到任何有关它的文档。 Firefox 4 beta 10 支持新的 Blob.slice
方法,该方法可对 Blob 实例进行切片。 slice
采用两个参数:blob.slice(start, length)
。现在,我感兴趣的是它是从 start + 1
还是从 start
开始切片,这意味着我必须为文件的每个切片将 start 增加 1。
有人尝试过这个吗?我在上传切片时遇到了一些问题,但是一旦完成,我也会在这里发布我的经验。
谢谢
Fabian
got a interesting question, but I can't find any documentation about it. Firefox 4 beta 10 supports the new Blob.slice
method, which slices a Blob instance. slice
takes two arguments: blob.slice(start, length)
. Now, I'm interested wether it slices from start + 1
or from start
, which would mean that I would have to increment start by one for each slice of the file.
Has anyone tried this out? I'm having some problems uploading the slices yet, but once that's done I'll post my experiences here as well.
Thanks already,
Fabian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,我得到了答案。结果我必须阅读 W3C 草案,但我没有。我对图像进行了切片,将它们一张一张地发送到 php 脚本,然后将它们重新组合在一起。但是,我现在遇到了一个完全不同的问题:文件以错误的顺序发送并以错误的顺序放在一起:'((可能是由于文件读取器的异步行为)。
无论如何,我很抱歉直接在这里发帖。我想我希望引发一场讨论...
祝好,
Fabian
ps.:如果有人对我的代码感兴趣,我会在它工作并添加功能(例如可暂停)后立即将其放在 github 上。上传、进度条等。请关注我的博客以获取发布信息(fabdrol.com)。
Ah, I got the answer. Turns out I had to read the W3C draft, but I didn't. I've sliced the images, send them one by one to a php script and put them back together. However, I've got a totally different problem now: the files are sent in the wrong order and put together in the wrong order :'( (probably due to the async behaviour of the file reader).
Anyway, I'm sorry for posting here directly. I guess I hoped to spawn a discussion...
Best regards,
Fabian
ps.: If anybody is interested in my code, I'll put it on github as soon as I get it working and added features, like pausable uploads, progress bars, etc. Keep an eye on my blog for release information. (fabdrol.com)