fileapi

Android HTML5 FileApi can i read file from SD Card?

旧街凉风 提交于 2019-12-11 23:20:58
问题 Is there a way for Website to read certain file from Android SDCard (i know that this file exist on SDCard) while working in browser? I want my website to open "certain video file" from SDCard (hugeXXX.avi) :) Is it even possible? 回答1: The HTML5 Filesystem API allows web pages to open and manipulate files only within a sandboxed filesystem. The browser decides where and how this sandboxed filesystem exists, and your webpage cannot break out of the sandbox to access arbitrary files on the

JS - How to compute MD5 on binary data

雨燕双飞 提交于 2019-12-11 20:14:35
问题 EDIT: changed title from "JS File API - write and read UTF-8 data is inconsistent" to reflect the actual question. I have some binary content i need to calculate the MD5 of. The content is a WARC file, that means that it holds text as well as encoded images. To avoid errors in the file saving, I convert and store all the data in arrayBuffers. All the data is put in UInt8Array s to convert it to UTF-8. My first attempt, for testing, is to use the saveAs library to save files from Chrome

Alter file contents before uploading

此生再无相见时 提交于 2019-12-11 05:05:06
问题 I would like to encrypt the contents of a file before uploading to our server .. we are using fineuploader. What I would like to do is: function onSubmitted(id) { var file = uploader.getFile(id); var reader = new FileReader(); reader.onload = function (e) { //encrypt here // but how do I save the file back to fineuploader? //then continue to submit/upload }; reader.readAsArrayBuffer(file); } is there any way of doing this out of the box or will I need to resort to rampant hackery :) :) 回答1:

File and Directory Entries API broken in Chrome?

假如想象 提交于 2019-12-11 03:25:20
问题 I'm trying to use the File and Directory Entries API to create a file uploader tool that will allow me to drop an arbitrary combination of files and directories into a browser window, to be read and uploaded. (I'm fully aware that similar functionality can be achieved by using an file input element with webkitdirectory enabled, but I'm testing a use case where the user isn't forced to put everything into a single folder) Using the Drag and Drop API, I've managed to read the DataTransfer items

Copying files from android_asset folder to SD Card

ぃ、小莉子 提交于 2019-12-10 23:26:14
问题 So, I want to play video files that are bundled in a Cordova app. To do that, I have to move them out of the android_asset folder and onto the SD card. I'd like to do this in JS via the File API, if at all possible. That being said, I seem to be unable to read from that folder with my Cordova WebView. I've tried a few different methods, but here are the two that, based on what I've read, should work: var url = 'file:///android_asset/www/my_video_folder'; var sourceDir = new DirectoryEntry( {

BLOB URL to file with PHP

亡梦爱人 提交于 2019-12-10 20:42:17
问题 I'm trying to create a file preview system. When the user click in a upload button and select files, I use the HTML5 FILE API to get all the file info and create a thumbnail for the file. The user can cancel the upload of some of thoose files and add more files too. What I have now is this: <p><input id="blob" name="blob" type="file" size="75" multiple /></p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input id="blobtype" name="blobtype" type="text" size="20" /> <input

Why did IE9 leave out support for the File API and the multiple attribute on file inputs?

有些话、适合烂在心里 提交于 2019-12-10 20:14:54
问题 Why did IE9 leave out support for the File API and the multiple attribute on file inputs? Chrome, Firefox and Safari support the features. But IE9 (and Opera) failed to support these for some unknown reason. For IE9 it seems we're still stuck with Flash for multiple file upload support (iframe hacks do not count). 回答1: File API is still a 'Working Draft'. Internet Explorer 10 will support File API (prototype) More Details 来源: https://stackoverflow.com/questions/4963903/why-did-ie9-leave-out

read Data URL with File API polyfill

瘦欲@ 提交于 2019-12-10 19:44:07
问题 I am trying to use the File API library (https://github.com/mailru/FileAPI) as a fallback for browsers which do not support the File API, in order to read a file as a Data URL and pass that on to another function. I have this code: function handleFileSelect(event) { // If supported, use native File API. if(window.FileReader != null) { console.log('Using native File API.'); // ! var files = event.target.files; for(var i = 0, f; f = files[i]; i++) { var reader = new FileReader(); reader.onload

html5 FileReader , what kind of data readAsDataUrl function returns? is it url adress? or data itself?

吃可爱长大的小学妹 提交于 2019-12-10 18:15:27
问题 function readURL(input){ if(input.files && input.files[0]){ reader.readAsDataURL(input.files[0]); } else { document.images[0].src = input.value || "No file selected"; } } function checkSrc(){ var src = document.getElementById('propertyImg').getAttribute('src'); console.debug(src); } <input type='file' class='width70_prop' onchange="readURL(this);"></input> <button onclick='checkSrc()'>check</button> I am curious what kind of data FileReader's readAsDataUrl function returns. When I checked src

How can I access pasted file in webkit browsers? (as Google Chrome)

隐身守侯 提交于 2019-12-10 13:29:31
问题 It would be very convenient if one was able to paste images here, on Stack Exchange instead of meddling with a file dialog. Similar feature was (is?) implemented here, but only for Webkit browsers. I was developing userscript that does that. Funny thing is that I never accomplished to get the file (which is different from raw image data) from clipboard in Webkit browsers, while in Firefox it works. Firefox solution: div.addEventListener('paste', function(event){ //I'm actually not sure what