Questions tagged [fileapi]

11

votes
1

answer
5k

Views

HTML5 and Amazon S3 Multi-Part uploads

Is it possible to use the HTML 5 File API (for example, this library: https://github.com/23/resumable.js ) in conjunction with the S3 multi-part upload feature? http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
sleepy_keita
7

votes
1

answer
1.4k

Views

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 play videos that are served from a remote host (say...
rajukoyilandy
2

votes
1

answer
3.6k

Views

How can access websockets in webworkers?

I need to send websocket calls from webworkers, how can i get it. I dont think so is there any support from the user agents. if support available please give me an example to do this. sample stuff what I am trying. var ws = new WebSocket(url); var worker=new Worker(worker.js); ws.onmessage=function(...
kirankumar
6

votes
2

answer
22.3k

Views

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
7

votes
4

answer
2.6k

Views

“undefined” returned when accessing some listed properties of File object

I can't seem to access the width or height keys of my object. I'm using dropzone.js which has an event for addedFile which returns the file and the first param. so: var myDropzone = new Dropzone('#dropzone', {url: '/'}); myDropzone.on('addedFile', function(file) { console.log(file); }); The callbac...
Shannon Hochkins
2

votes
1

answer
3.7k

Views

Phonegap FileReader readAsText returns null but readAsDataURL works

I'm using Phonegap to download an archive, unzip it, then read the files. It's all working until I try and read the files as text. If I use readAsDataURL() then I get a whole heap of stuff logged to the console. function( file ) { console.log(file); var reader = new FileReader(); reader.onloadend =...
Pete
3

votes
1

answer
1.1k

Views

Content-Disposition with ng-file-upload and angularjs

Background: I am using ng-file-upload to submit two files in separate ngf-selects and also a Javascript object literal. The issue i have is that when the request is sent the content-disposition of all the parts is set to form-data but what i would expect is for the content-disposition of the two fil...
Graham
8

votes
2

answer
24.9k

Views

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 images without base64 encoding them? readAsBinaryStrin...
sissonb
25

votes
1

answer
44.6k

Views

How to create File object from Blob?

DataTransferItemList.add allows you to override copy operation in javascript. It, however, only accepts File object. Copy event The code in my copy event: var items = (event.clipboardData || event.originalEvent.clipboardData); var files = items.items || items.files; if(files) { var blob = Blob.fromD...
Tomáš Zato
6

votes
1

answer
4.8k

Views

File API: What browsers support the slice method?

What is the current support for the slice method?
Alex Polo
5

votes
2

answer
6k

Views

After uploading a file to Drupal 7 via a form, how to get the file's path?

I have a form that uploads a file to my Drupal installation. I want to store the path to that file in a table. How do I get the path to the recently uploaded file? I tried $f = file_load($form_state['values']['field_file']); $f->uri; But that's not working. Any clues?
KerrM
2

votes
1

answer
4.7k

Views

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. I want to load file when the page loads. When I...
Wanderer
2

votes
1

answer
4.8k

Views

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 recommend doing something like this: // sender dat...
Hristo
2

votes
1

answer
3.8k

Views

read file and display content in javascript

I need to save some data in a file and when loading the page i want to read this file and add this data to the page. I don't know why but this assignment is useless so we can't use database nor server stuff, so i have to save and read from a local file. I searched the net and found knew that it...
Ameen
7

votes
2

answer
33.3k

Views

JS and type.match as file mime type - need advice

Today I faced an interesting thing as FF File API and separate files by their types. OK here is a little snippet as if (!input.files[0].type.match('image.*')) { window.alert('Select image please'); return; } it controls image being read only. But what about doc files and pdf for example? I couldn't...
user592704
33

votes
4

answer
26.8k

Views

Adding UTF-8 BOM to string/Blob

I need to add a UTF-8 byte-order-mark to generated text data on client side. How do I do that? Using new Blob(['\xEF\xBB\xBF' + content]) yields ''my data'', of course. Neither did '\uBBEF\x22BF' work (with '\x22' == ''' being the next character in content). Is it possible to prepend the UTF-...
kay
2

votes
1

answer
4.9k

Views

The File API isn't working in IE9

I'm trying to get the file size and file type from an input field from my form using jQuery. I thought it was working however apparently not in IE 9. Any insight would be greatly appreciated var my_field = this.files[0]; var myInteger = parseInt(my_field.size); var myType = my_field.type;
user875293
2

votes
1

answer
91

Views

File and Directory Entries API broken in Chrome?

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...
2

votes
1

answer
5.5k

Views

Javascript can you serialize a File object

I need to serialize a File object from a file input, so that the object can be saved, parsed back to a file object, and then read using the FileReader object. Does anyone know if this is possible in Google Chrome? I think the problem lies in the protection of the file.path property. Webkit browsers...
Jesse Kinsman
30

votes
3

answer
65.6k

Views

Convert base64 png data to javascript file objects

I have two base64 encoded in PNG, and I need to compare them using Resemble.JS I think that the best way to do it is to convert the PNG's into file objects using fileReader. How can I do it?
Bonik
39

votes
3

answer
44.7k

Views

Getting Image Dimensions using Javascript File API

I require to generate a thumbnail of an image in my Web Application. I make use of the Html 5 File API to generate the thumbnail. I made use of the examples from the below URL to generate the thumbnails. http://www.html5rocks.com/en/tutorials/file/dndfiles/ I am successfully able to generate the th...
Abishek
11

votes
1

answer
7.7k

Views

Failed to construct 'File': Iterator getter is not callable in chrome 60 when use JSON.stringify()

System Configuration : macOS Sierra 10.12.5 ; chrome 60; I am trying to download JSON data ( response object ) as a json file but when I tried to achive this using browser File() object , it gives error Failed to construct 'File': Iterator getter is not callable. below is my code //`inputData` is t...
diEcho
17

votes
2

answer
4.8k

Views

Is the FileAPI in HTML5 dead?

Referring to the HTML5 FileAPI in particular. I am going through the W3C specification proposals, and from what one can read here: http://www.w3.org/TR/file-system-api/ 'Work on this document has been discontinued and it should not be referenced or used as a basis for implementation.' Is the FileAPI...
1

votes
1

answer
1.3k

Views

IIS7 using HTML5 File API returns 404 for big files

I'm trying to implement File API for image uploading following this example http://robertnyman.com/html5/fileapi-upload/fileapi-upload.html On the server side I'm using ASP.NET MVC 3 with IIS7 (integrated, 32 bit only) Everything works fine locally with Development Server and IIS7.5. On the server i...
pbz
2

votes
2

answer
778

Views

How to use HTML5 File API with Unobtrusive JavaScript?

I would like to use the HTML5 File API with unobtrusive JavaScript. But I can only get it working by calling JavaScript functions from the HTML. Is there any way to use the File API with unobtrusive JavaScript? The File API is not supported by all browsers, but I have tried this in Google Chrome and...
Jonas
0

votes
1

answer
1.2k

Views

using Mozilla FormData with jquery $.ajax call

I am using html5 to allow allow drag and drop of files , and submit form data along with files in a multipart/form-data request with the mozilla FormData() api ( there is a append() function for a FormData object and I append values and files with it ). I use the jQuery.ajax() and set the data...
dan_l
2

votes
1

answer
2.3k

Views

How to get progress when uploading file VIA XMLHttpRequest

I am wondering how to get the progress of a file upload using XMLHTTPRequest. In Firefox the onprogress method does not fire at all, and in chrome it only fires after the file has finished uploading. function fileUpload(file) { var formData = new FormData(); formData.append('file', file); var xhr =...
Kenneth Spencer
25

votes
3

answer
56k

Views

HTML5 File API downloading file from server and saving it in sandbox

I'm trying to understand HTML5 API. I'm designing the web application where the browser client need to download multiple files from server; user will perform something with the downloaded files and the application than need to save the state on user hard-rive. I understand that the browser can save...
Mamadum
3

votes
1

answer
14.2k

Views

how to catch ngchange event in a file input

I have a file input Now in my controller I dont want to do selectors and stuff. so I just have $scope.action = () -> ... However, I want a certain behavior such that as long as user selects a File the $scope.action is called, instead of onchange is there onselect event in angular?
user2167582
5

votes
2

answer
6.7k

Views

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,' + encodeURIComponent(content); OR content = 'abc123';...
Josh Mc
4

votes
1

answer
666

Views

JS function returns null - help

I am trying to modify the example http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files to make function handleFileSelect(evt) return reader.result; I mean to make function return base64 for image or so. I tried to write it with function but it returns null only :( So my question...
user592704
3

votes
2

answer
6.3k

Views

FileReader read as DataUrl

I am working on this app on the Chrome App Store. Evidently the File API changed, so I needed to implement FileReader to get the local URL of a file that is dropped onto the page. function drop(evt) { v = evt.target.id; evt.stopPropagation(); evt.preventDefault(); var files = evt.dataTransfer.files...
Isaac Lewis
2

votes
2

answer
86

Views

<img>width returns 0 under heavy load

The below handleFiles method is being passed files from both drag and drop and a file input. After it gets the data url for a given file it passes it to the processImage function. This function creates a new image and sets the src and file for that image. I then take different actions based on the w...
bmck
40

votes
4

answer
32.2k

Views

Remember and Repopulate File Input [duplicate]

This question already has an answer here: How to set file input value when dropping file on page? [duplicate] 1 answer Note: The answer(s) below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element via JavaScript in 2017. See the answer in this...
user1150103
2

votes
1

answer
1.5k

Views

How to merge two array buffers into one?

I have a big blob for a rar file. To uncompress it I had to use this library unrar.js The blob I am testing with is about 23MB, to readAsArrayBuffer then feed it to unrar.js I had to slice it. For some reason unrar.js does not play well with sliced blobs--it would throw an unknown archive type erro...
Zahema
2

votes
1

answer
1.6k

Views

How to download multi-part file from multiple servers

I am working on a project that would require downloading a file that is stored on multiple servers in parts. Requirements: The solution must be with java-script on the client side. It should support working with large files ~ 50G and more. It should be fast and not crash the browser from m...
Max
2

votes
1

answer
4.4k

Views

ionic download file, save to temporary filesystem and open with default app

I've searched far and wide but couldn't find an appropriate answer for my use-case. Basically I'd like to download a base64-encoded file (could be a pdf, pgn, jpeg - using a pdf in the following example) from my backend, save it to a TEMPORARY fileSystem folder, then open it - possibly using the ap...
Andrea Aloi
1

votes
2

answer
704

Views

Can't catch file upload at server side using HTML5 File API and ASP.NET MVC4

I'm using the HTML5 File API features to create beatiful file uploader for my website. But I've got some problems with the server side (where I use ASP.NET MVC 4). I couldn't see any file data at the breakpoint in VS, it's just always equaled to the null value. Breakpoint is firing (so by this logic...
11

votes
4

answer
7.1k

Views

file input size issue in safari for multiple file selection

I am experiencing inconsistencies with regard to multiple file upload in Safari 5.1 on Windows Vista (haven't tried other platforms). The input element has the multiple flag to allow selection of multiple files. The problem occurs when the user does actually select more then one file. In this cas...
rewolf
11

votes
1

answer
6.4k

Views

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' occurres. The file I try to read is a regular .txt fil...