fileapi

window.resolveLocalFileSystemURL vs window.requestFileSystem

家住魔仙堡 提交于 2019-12-10 01:56:39
问题 What is the difference in using window.resolveLocalFileSystemURL vs window.requestFileSystem when downloading files with the cordova file plugin? I cant find any documentation on resolveLocalFileSystemURL but it works fine, and its easier to use? Which one should I use for simple CRUD operations in a cordova app? (I use cordova 3.4.0-0.1.3) I use it like this: function onResolveSuccess(fileEntry) { fileEntry.file(function(file) { var reader = new FileReader(); reader.onloadend = function(evt)

File field - Append file list

我与影子孤独终老i 提交于 2019-12-09 20:45:03
问题 I have made me a simple file field: <input type="file" name="pictures_array[]" multiple accept="image/*" id="page_pictures_array" /> and some HTML5 File API code to list the files: $('.page-form #page_pictures_array').change(function(evt) { var file, files, reader, _i, _len; files = evt.target.files; console.log(files); $('#file-list').empty(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; reader = new window.FileReader; reader.onload = (function(file) { return

Disable File drag & drop if there isn't a file input

只愿长相守 提交于 2019-12-09 18:13:30
问题 I think the solution to this is staring me in the face, but I can't seem to find it. So, I'm making a site that has a small file upload section. The upload section will have a place to upload an image for different devices and device orientations (i.e. iPhone, iPad, portrait and landscape). I can easily figure out how to implement the drag & drop on the individual device icons, but if the user misses the drop area, the browser will just navigate to that image on their system. How do I disable

HTML5 File API - slicing or not?

时光总嘲笑我的痴心妄想 提交于 2019-12-09 06:38:04
问题 There are some nice examples about file uploading at HTML5 Rocks but there are something that isn't clear enough for me. As far as i see, the example code about file slicing is getting a specific part from file then reading it. As the note says, this is helpful when we are dealing with large files. The example about monitoring uploads also notes this is useful when we're uploading large files. Am I safe without slicing the file? I meaning server-side problems, memory, etc. Chrome doesn't

HTML5 File API with Remote File

泪湿孤枕 提交于 2019-12-08 02:51:56
问题 I am trying for hours to use the HTML5 FileSystem to add a remote file with an URL (like http://example.com/doc.pdf) instead of the file obtained by the file input because I want the process to be automatic (I have more than one doc) but I didn't found anything about the process... All examples I found concern local files (added with a file input)... I give you few lines of my code : window.requestFileSystem(TEMPORARY, 1024 * 1024 * 10, function(fs) { FS_ = fs; addRemoteDocuments(); },

Drag and drop image(s) from desktop to browser instead of searching via input

廉价感情. 提交于 2019-12-07 17:49:21
问题 I'll be honest, way out of my depth here so any help or guidance would be great. I have a very basic input form that allows me to choose multiple images from local folders and display them on the page as well as display info such as file type/name/size. I'd like to be able to drag and drop images into the page, rather than manually search for the images each time. This is where I'm stuck. I have no idea what I need to google to get my desired result. I've seen a lot around the file API that I

traverse through each file in SD card using phonegap file api

落爺英雄遲暮 提交于 2019-12-07 13:13:09
问题 I want to traverse through each file in the SD card inside all the directories and sub directories using the FILE API of phonegap (which is the w3c file api actually). I have to perform a certain set of operations on these files by looking at their nature. I donot want to search for specific types of files, but traverse through each file in a sequential manner. Can someone please help me with this? Just a basic loop framework with the necessary requirements for the traversal would be a great

How to iterate through file system directories and files using javascript?

大憨熊 提交于 2019-12-07 13:08:42
问题 I'm using Javascript to write an application that will be used with Phonegap to make an Android application. I'm using the Phonegap File API to read directories and files. The relevant code is shown below: document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap is ready // function onDeviceReady() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail); } function onFileSystemSuccess(fileSystem) { fileSystem.root.getDirectory("/sdcard", {create

Getting FileError when trying to use the HTML5 file api in google chrome

ⅰ亾dé卋堺 提交于 2019-12-07 12:13:01
问题 I was trying to create a file using the file system API in chrome. Initially I tried PERSISTENT storage as follows window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; webkitStorageInfo.requestQuota(webkitStorageInfo.PERSISTENT, 1024*1024, function(grantedBytes) { window.requestFileSystem(webkitStorageInfo.PERSISTENT, grantedBytes, onInitFs, errorHandler); }, errorHandler); It was working fine initially. But now when I try the same code is giving me the

Replacement for fileEntry.toURL() in Chrome Packaged Apps

我是研究僧i 提交于 2019-12-07 12:07:03
问题 I'm using the HTML5 FileSystem API in a Chrome Packaged App to write to a log file. I want the user to be able to download this file, so I tried something along the lines of: fs.root.getFile('log.txt', {create: false}, function(fileEntry) { var url = fileEntry.toURL(); // do something with the file url }); This doesn't help though, because the URL is something like filesystem:chrome-extension://eekedjcagggbfigdmifkmhkjbhiklnpj/temporary/log.txt and it's not possible to open it somewhere. What