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
7
votes
2 answers

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

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…
Nick
  • 2,261
  • 5
  • 33
  • 65
7
votes
1 answer

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

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…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
7
votes
1 answer

Maximum files of a directory that can be read by FileReader#readEntries in JavaScript

I'm creating a Chrome application. I must read the files of a directory and I am using the DirectoryEntry API and DirectoryReader API. My problem is that the maximum files read using DirectoryReader#readEntries is 100, the first 100 (alphabetical…
fhuertas
  • 4,764
  • 2
  • 17
  • 28
7
votes
3 answers

How to write UTF-8 or Base64 data into a file (jpg/doc/pdf) on local storage(sdcard) in Phonegap

I am getting byte array like var byteArr=[12,-123,43,99, ...] from API, Then I am converting it into UTF-8 String by var utf8_str = String.fromCharCode.apply([], new Uint8Array(byteArr)); Then converting UTF-8 string to Base64 string by …
Saurabh
  • 254
  • 1
  • 4
  • 12
7
votes
1 answer

How to create a File object from binary data in JavaScript

I'm probably missing something simple here, but how would I create a File object in JavaScript given the binary data as received from an AJAX request? $.ajax({ url: "http://example.com/image.jpg", success: function(data) { // Convert binary…
David Jones
  • 10,117
  • 28
  • 91
  • 139
7
votes
1 answer

Cross-domain chunked uploads using CORS

I have user-submitted files that I'm trying to upload in 10 MB chunks. I'm currently using raw XMLHttpRequest (and XDomainRequest) to push each individual slice (File.prototoype.slice) on the front end. The back end is Nginx using the upload…
fearphage
  • 16,808
  • 1
  • 27
  • 33
7
votes
1 answer

Samsung TV Video Caching using HTML5 and JS

I have to develop a Samsung TV application to play videos that are served from a remote server, which I don't have access to. Actually I've made an application to play videos of my own server. But my current requirements are as follows: I want to…
rajukoyilandy
  • 5,341
  • 2
  • 20
  • 31
6
votes
2 answers

IE and local file reading

I've just watched the mozilla File API file reading as new FileReader(); etc. and I must ask is there something like that for IE?
user592704
  • 3,674
  • 11
  • 70
  • 107
6
votes
2 answers

How can i generate a file and offer it for download in plain javascript?

I would like to generate a text file in the javascript dynamicly, then offer this for download. Currently I can get this working to a degree with either of the following solutions: content = "abc123"; document.location = "data:text/octet-stream," +…
Josh Mc
  • 9,911
  • 8
  • 53
  • 66
6
votes
2 answers

How to send JSON object with ArrayBuffer to websocket?

I'm trying to simply upload a file to a node.js server. To do this, I'm using the file API and readAsArrayBuffer. Here's the code that's called when the input file "change" event is fired, along with some hepler functions (and I'm using the COBY…
Yaakov5777
  • 309
  • 5
  • 15
6
votes
1 answer

File object to image with correct file name instead of src="blob..."

I have a File object myFile that looks like this in console: File { name: "myimage.jpg", lastModified: 1465476925001, lastModifiedDate: Thu Jun 09 2016 14:55:25 GMT+0200 (CEST), size: 33002 type: "image/jpeg" } But when i create an…
Mick
  • 8,203
  • 10
  • 44
  • 66
6
votes
1 answer

Pass submited file to web worker by refference with as little overhead as possible

I will have a web worker to parse huge text file (200000 lines, simple syntax though). I expect user to submit that file wia drag'n'drop or otherwise, obtaining a File object: var work = new Worker("parser.js") …
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
6
votes
1 answer

Create a FileList and copy it to a File input

I'm trying to create a drag and drop area that will get dataTransfer items by webkitGetAsEntry and check if the entry is a directory or file. I then would like to be able to make the files into a FileList and copy that to a file input (that will be…
6
votes
1 answer

Reading multiple files in a loop using HTML5 File API

I am using the HTML5 File API to read binary files. The user can select multiple files and then click a button to copy them into a JavaScript object. My code is listed here: