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
20
votes
1 answer

Read file stream using JavaScript in web browser

In web browser, I want to compute sha1 checksum of a huge file in the local filesystem without sending it to a server. File API supports to read files from local disk but I guess it reads the entire of the file and put all of them into the memory.…
npcode
  • 1,370
  • 1
  • 14
  • 29
19
votes
1 answer

How to upload and list directories at firefox and chrome/chromium using change and drop events

Both mozilla and webkit browsers now allow directory upload. When directory or directories are selected at element or dropped at an element, how to list all directories and files in the order which they appear in actual directory…
guest271314
  • 1
  • 15
  • 104
  • 177
19
votes
1 answer

Fast low-collision non-crypto hash in JavaScript for Files

I am looking for a fast hash with low collisions implemented in JavaScript. It doesn't need to be a crypto hash. I am basically using it as a way to see if a given file has already been uploaded (or partially uploaded) to a user's account to save…
Eric Anderson
  • 3,692
  • 4
  • 31
  • 34
17
votes
2 answers

HTML5 File API: FileReader.readAsText() returns "undefined"

I use Chrome 12 on Mac OS X and I've included jQuery 1.6.1 within the document. I try to read the contents of a file as text and save it in a data-object with the following function: this.upload = function(file) { console.log('FileHandler.upload…
Claudio Albertin
  • 2,076
  • 4
  • 18
  • 20
17
votes
2 answers

How do I generate a thumbnail client-side in a modern browser?

I'm looking for an elegant way to generate a thumbnail for use with the FileAPI. Currently I get a DataURL representing an image. Problem is, if the image is very large, than moving it around and rerendering it becomes CPU intensive. I can see 2…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
17
votes
2 answers

Writing file to desktop using HTML5 FileSystem API

I'm playing around a bit with the FileSystem API. I've found a lot of examples where you generate a download link and let the user download the file the "browser way". I would like to know two things: Is there any way to write the ajax result in…
Johan
  • 35,120
  • 54
  • 178
  • 293
16
votes
2 answers

Instantiate File object in Microsoft Edge

I'm trying to create an image file from a blob-object using the File API and then add it to a form to be sent via XHR. Works like a charm in chrome, but crashes the app in Microsoft Edge. let file = new File([blobContent], "image.png"); let form =…
mottosson
  • 3,283
  • 4
  • 35
  • 73
15
votes
1 answer

What is the purpose of webkitRelativePath property in File object?

If you printout File object in Chrome console with something simple like this: you will see among other properties an always empty webkitRelativePath property: fileName: "07.png" fileSize:…
jayarjo
  • 16,124
  • 24
  • 94
  • 138
15
votes
3 answers

How to convert image source into a JavaScript File object

I have an image URL "https://cdn.shopify.com/s/files/1/0234/8017/2591/products/young-man-in-bright-fashion_925x_f7029e2b-80f0-4a40-a87b-834b9a283c39.jpg", and want to convert it into javaScript File Type object. : File lastModified:…
Kumar
  • 436
  • 1
  • 4
  • 16
14
votes
2 answers

window.URL.revokeObjectURL() doesn't release memory immediately (or not at all)?

I'm making an html interface to upload images on a server with Drag & Drop and multiple selection files. I want to display the pictures before sending them to the server. So I first try to use FileReader but I have had some problems like in this…
Seb
  • 300
  • 1
  • 4
  • 16
14
votes
2 answers

Youtube Blob urls don't work in browsers but in src

I know that there are no blob urls only objects. I made my own blob object for a video buffer and then I used it in a src of video tag which is something like blob://website.com/blablobbla . I opened this url in the browser it worked when I opened…
Waqas Tahir
  • 7,171
  • 5
  • 25
  • 47
14
votes
5 answers

overwrite a file with HTML5 FileWriter

I'm using HTML5 FileWriter API to save the state of my webapp. I have bit of JS that periodically calls FileWriter.write to do that (so , over time, the write method is called several times). By default FileWriter API use an 'append' approach to…
htulipe
  • 1,575
  • 1
  • 10
  • 22
13
votes
3 answers

IOS6 and Safari Photo Uploading - File API + Canvas + jQuery Ajax Uploading and Resizing Files Asynchronously

IOS6 has been released and I've been testing photo uploading. It works well, but with larger images over 3G it is SLOW as expected. Thanks to File API and Canvas, it is possible to resize images using JavaScript. I hope that if I resize the images…
TaylorMac
  • 8,882
  • 21
  • 76
  • 104
12
votes
2 answers

jquery.support to detect JavaScript's File API?

I can't find the way to detect if the browser supports the File API through the .support methon in jQuery. Anyone knows it? (Incidentally: a way to detect the size of a file in input[type=file] with IE?)
Naoise Golden
  • 8,793
  • 4
  • 49
  • 65
12
votes
1 answer

HTML5 FIle API: Security Error while reading a file

Problem solved, read comment The third problem I have with the HTML5 File API: I still use Chrome 12 on Mac OS X Snow Leopard and I'm still trying to read files with the HTML5 File API, but FileHandler.error() get called because a "SECURITY_ERR"…
Claudio Albertin
  • 2,076
  • 4
  • 18
  • 20
1 2
3
35 36