Questions tagged [fileapi]

Use this tag for questions related to the W3C File API. The W3C File API specifies how file objects should be represented and how their properties should be accessed.

The W3C File API at https://w3c.github.io/FileAPI/ specifies how file objects should be represented and how their properties should be accessed.

The File API spec includes the following interfaces:

  • Blob - raw binary data. Blob objects can be created via the Blob() constructor, but their properties are read-only.
  • File - a specific type of Blob with additional read-only properties.
  • FileList - a collection of File objects.
  • FileReader - provides asynchronous access to a content of a Blob or File object.

Related Tags

Resources

532 questions
9
votes
1 answer

Cordova FileEntry can't return File -> FILE_NOT_FOUND_ERR

I'm trying to get a file from iOS filesystem. My file is located at: console.log(PATH); --> file:///var/mobile/Applications/B816F30B-791A-43E5-B33A-A26075E8B585/Documents/123123123.wav Now I'm trying to get the File via File…
matthisb
  • 1,108
  • 12
  • 29
9
votes
1 answer

Firefox -- "FileReader is not defined" only when called from Web Worker

In Firefox, the following code works correctly when run in the main browser thread as normal-- var fr = new FileReader(); ..but when run from a web worker, the following error is thrown: FileReader is not defined The same code works fine in…
Stu Blair
  • 1,323
  • 15
  • 24
9
votes
4 answers

Quota exceeded trying to create file with HTML File API

In a packaged Chrome app, I'm trying to read from a file in the PERSISTENT storage, and create it if it doesn't exist: window.webkitRequestFileSystem(PERSISTENT, 1024*1024, function(fileSystem) { fileSystem.root.getFile('file.txt', {create:…
8
votes
4 answers

Is there a Javascript support library for html5 file API and upload?

until now I was using flash based swfupload and its swfupload.js which provides users with callbacks from flash and a possibility to set it up. I was wondering if there is anything like this for HTML5 File API. I'm asking before I make it from…
lisak
  • 21,611
  • 40
  • 152
  • 243
8
votes
1 answer

download file client-side chunk by chunk

I'm using WebRTC to send a file to a connected peer, and I'm sending the file in chunks. However, I'm having trouble figuring out how to get the peer to save/download the file as it is streaming in, chunk by chunk. All the examples I've found online…
Hristo
  • 45,559
  • 65
  • 163
  • 230
8
votes
2 answers

Use FileAPI to download big generated data file

The JavaScript process generates a lot of data (200-300MB). I would like to save this data for further analysis but the best I found so far is saving using this example http://jsfiddle.net/c2U2T/ which is not an option for me, because it looks like…
Alex Netkachov
  • 13,172
  • 6
  • 53
  • 85
8
votes
2 answers

encode/decode image with base64 breaks image

I am trying to encode and decode an image. I am using the FileReader's readAsDataURL method to convert the image to base64. Then to convert it back I have tried using readAsBinaryString() and atob() with no luck. Is there another way to persist…
sissonb
  • 3,730
  • 4
  • 27
  • 54
8
votes
1 answer

FileAPI doesn't update the files size when user makes file changes (non-webkit browsers)

I figure I'd demonstrate the problem with an example first, jsfiddle: http://jsfiddle.net/e2UfM/15/ (Tested with FF 12, and Chrome 18.0.1025.168) Usage: Load in a text file from your local machine. Hit "load file". Hit "display file size" - note…
Jay
  • 18,959
  • 11
  • 53
  • 72
7
votes
2 answers

HTML5 File API - slicing or not?

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,…
fabrik
  • 14,094
  • 8
  • 55
  • 71
7
votes
2 answers

Disable dragging of a file system image into a browser.

I am experimenting with the HTML5 file API. I notice however that browsers have a default behaviour where they display an image if you drag the image into the browser. This can however be annoying if your aim is to upload the image rather than to…
Kenneth Spencer
  • 1,392
  • 12
  • 15
7
votes
1 answer

Understanding Object URLS for client-side files and how to free the memory

I am using createObjectURL to get a reference URL to a local image file. When I am done with the file/image, I call revokeObjectURL to free that memory. Everything works fine for me but I just want to be sure that I am releasing all the memory I…
rewolf
  • 5,561
  • 4
  • 40
  • 51
7
votes
1 answer

How to check if a pdf File is in US Legal or US Letter format in the browser in JavaScript

I'm running in the browser. I have File (the JavaScript File type) of type application/pdf. I want to check that the format of the pdf is either US Letter (8.5 in. x 11 in.) or US Legal (8.5 in. x 14 in.) in either landscape or portrait…
snowfrogdev
  • 5,963
  • 3
  • 31
  • 58
7
votes
1 answer

File API: What browsers support the slice method?

What is the current support for the slice method?
Alex Polo
  • 430
  • 1
  • 6
  • 7
7
votes
1 answer

Can you create a Javascript File List or File object without html file input

I'm creating an offline javascript app that uses sql.js to load a sqlite database, add some filters and query the data and display various d3 based charts. However my users don't want to be bothered with the database stuff and having database file.…
Wanderer
  • 544
  • 1
  • 7
  • 23