fileapi

Save files into selected directory (javascript)

情到浓时终转凉″ 提交于 2019-12-01 23:24:47
问题 Hello! My question is about javascript. I want to 1. ask a user to select a directory 2. then write my bunch of files to it (probably with creating sub-directories) without interaction with user How can I do this? And can I? I am new in javascript and I hope for your help. PS. I've heard about ability to ask a user to select a path by save file dialog and then save data to selected file, but i want to ask a user once for selecting a directory and then create a bunch of files in it without

How to Create a New Folder for Downloading a File

我的梦境 提交于 2019-12-01 22:32:53
I want to download folder that client side (browser) make. I considered using File API , but I can't find how to make folder. For example, some png make from html canvas put one folder, I want to save this folder with download dialog. I want to use a folder for some file to one folder.and I must download only once. Please advise me. html <a download='folder' href='#' onclick="Download()">download</a> You can use FSO.js , but be warned that it currently only works in Chrome. Additionally, the folders you create can only really be accessed from within your webapp (for example, you can't choose

What are the details can be obtained from webkitStorageInfo.queryUsageAndQuota()

送分小仙女□ 提交于 2019-12-01 21:22:32
webkitStorageInfo.queryUsageAndQuota() is used to find out the usage stats of the files that have been stored in the file system using the HTML5 file system API I suppose. Can anyone give me the details that can be obtained in the callback provided to this function. window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, function() { //what all details can be obtained in this function as its arguments? }) Replace function(){...} with console.log.bind(console) , and you will find out. > window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, console.log.bind

Using HTML 5 File API to load a JSON file

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 19:54:25
I want the user to be be able to chose a JSON file on there computer, this JSON file should then be made available to the client side Javascript. How would I do this using the FILE API, the ultimate goal is the the user selected JSON file to be available as an object which I can then play about with in Javascript. This is what I have so far: JsonObj = null function handleFileSelect(evt) { var files = evt.target.files; // FileList object f = files[0]; var reader = new FileReader(); // Closure to capture the file information. reader.onload = (function(theFile) { return function(e) { // Render

Javascript FileAPI: Iterating Directories?

六眼飞鱼酱① 提交于 2019-12-01 11:32:49
Firefox 3.6 let's you drop a directory onto some element (using the Drag And Drop API) and process those files with the FileAPI . How does that work with directories? The Mac OS X Finder displays some directories as Files (.app, .tmbundle, .abbu, …). In most cases this is wonderful. In the case of interacting with the browser via File- and DND-APIs it's not. The end-user is incapable of differentiating between a real file and a sort-of-file like my-addressbook-backup.abbu. The Javascript UI must therefore be able to identify directory structures. If it's not capable of traversing the structure

How to get progress when uploading file VIA XMLHttpRequest

元气小坏坏 提交于 2019-12-01 11:04:51
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 = new XMLHttpRequest(); xhr.onprogress = function(e) { alert('progress'); }; xhr.open('POST', 'post.php', true); xhr.send(formData); // multipart/form-data } Try xhr.upload.onprogress . In the XMLHttpRequest2 spec XMLHttpRequest have upload attribute. The ability to register for progress events. Both

Javascript FileAPI: Iterating Directories?

江枫思渺然 提交于 2019-12-01 09:39:07
问题 Firefox 3.6 let's you drop a directory onto some element (using the Drag And Drop API) and process those files with the FileAPI. How does that work with directories? The Mac OS X Finder displays some directories as Files (.app, .tmbundle, .abbu, …). In most cases this is wonderful. In the case of interacting with the browser via File- and DND-APIs it's not. The end-user is incapable of differentiating between a real file and a sort-of-file like my-addressbook-backup.abbu. The Javascript UI

How to get progress when uploading file VIA XMLHttpRequest

被刻印的时光 ゝ 提交于 2019-12-01 08:20:43
问题 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 = new XMLHttpRequest(); xhr.onprogress = function(e) { alert('progress'); }; xhr.open('POST', 'post.php', true); xhr.send(formData); // multipart/form-data } 回答1: Try xhr.upload.onprogress . In the

FileReader.js nothing happens in IE9

时光怂恿深爱的人放手 提交于 2019-12-01 07:12:49
I need help setting up Jadriens FileReader.js . I have set up everything as I think this polyfill works. But the callback that fires when everything is initiated doesn't fire in IE9. This is my markup: <body> <div class="main"> <canvas id="mainCanvas" width="600" height="600"></canvas><br /> <div id="fileReaderSWFObject"></div> <input type="file" id="imageLoader" name="imageLoader" /><br /> <input id="text" type="text" placeholder="some text..."> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js

FileReader.js nothing happens in IE9

允我心安 提交于 2019-12-01 04:13:49
问题 I need help setting up Jadriens FileReader.js. I have set up everything as I think this polyfill works. But the callback that fires when everything is initiated doesn't fire in IE9. This is my markup: <body> <div class="main"> <canvas id="mainCanvas" width="600" height="600"></canvas><br /> <div id="fileReaderSWFObject"></div> <input type="file" id="imageLoader" name="imageLoader" /><br /> <input id="text" type="text" placeholder="some text..."> </div> <script src="//ajax.googleapis.com/ajax