filereader

Feed FileReader from server side files

戏子无情 提交于 2019-12-24 13:06:56
问题 I´m starting to customize/improve an old audio editor project. I can import audio tracks to my canvas VIA drag&drop from my computer. The thing is that I also would like to use audio tracks already stored in the server just clicking over a list of available tracks... instead of use the <input type="file"> tags. How can I read the server side files with a FileReader?Ajax perhaps? Thanks in advance. This is the code for the file reader: Player.prototype.loadFile = function(file, el) { //console

SpringBoot2.0(二十二):实时Console查看_xffjs.com

▼魔方 西西 提交于 2019-12-24 11:55:27
在项目部署到正式环境中不免会出现一些bug,出现bug时需要查看日志,为了方便查看日志可以在后台做一个实时Console查看功能! Controller: import com . alibaba . fastjson . JSONObject ; import com . xffjs . framework . config . SystemConfig ; import com . xffjs . framework . web . controller . BaseController ; import lombok . extern . slf4j . Slf4j ; import org . apache . shiro . authz . annotation . RequiresPermissions ; import org . springframework . stereotype . Controller ; import org . springframework . web . bind . annotation . * ; import java . io . File ; import java . io . FileReader ; import java . io . IOException ; import java . io .

Waiting for a file to load (onload JavaScript)

那年仲夏 提交于 2019-12-24 10:00:02
问题 I want to read a text from a file and return it in a function. So here's the important part of my code: function getFileRequest(id, contentType, callback) { var val = "x"; if (window.File && window.FileReader && window.FileList && window.Blob) { var element = document.getElementById(id); var file = element.files[0]; if(file != null) { if(file.type.match("text/xml")){ var r; r = new FileReader(); r.onload = function (e) { val = e.target.result; } r.readAsText(file); } else alert("Wrong file

get the value from a FileReader in Angular 2

梦想的初衷 提交于 2019-12-24 04:53:34
问题 I have the following component that load a file and bind his content as string export class NgCsvComponent { @Input() csv: any; @Output() csvChange: any = new EventEmitter(); public localCsv : any = ''; constructor() { } changeListener($event): void { this.readFile($event.target); } readFile (inputValue : any) : void { let reader = new FileReader (), file : File = inputValue.files[0]; reader.readAsText(file); reader.onload = this.onLoadCallback; } onLoadCallback (event) { this.csvChange.emit

Javascript variable not changing inside onload function

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:43:27
问题 this code always return me '3' in alert. I select two files together (ones .mp4 format and second ones .zip format) function readFile(input) { var counter = input.files.length; for(x = 0; x<counter; x++){ if (input.files && input.files[x]) { var extension = input.files[x].name.split('.').pop().toLowerCase(); var reader = new FileReader(); reader.onload = function (e) { urlss = 1; if(extension == 'mp4'){ urlss = 2; }else{ urlss = 3; } alert(urlss); }; reader.readAsDataURL(input.files[x]); } }

Why I can't read /proc/net/xt_qtaguid/stats correctly by FileReader in Android ICS

对着背影说爱祢 提交于 2019-12-24 02:23:30
问题 I want to read /proc/net/xt_qtaguid/stats in Android ICS, which records all interfaces and applications traffic stats. following is the code snippet: String line = null; BufferReader reader = new BufferedReader(new FileReader(new File("/proc/net/xt_qtaguid/stats"))); line = reader.readLine();/*Here I can read the 1st line correctly, it return "idx iface acct_tag_hex..."*/ splitLine(line, keys); line = reader.readLine();//!!!!!Read next line, it returns null!!!!!! If I cat this file, it will

Transcrypt and FileReader

点点圈 提交于 2019-12-24 01:56:13
问题 I am trying to load a local image file into the browser. The code doesn't work. It always returns null for the result of the Filereader. The code for read_file3.py : #!/usr/bin/env python # -*- coding: utf-8 -*- class TestSystem: def openFile(self, event): self.inputvar = event.target console.log("self.inputvar"+self.inputvar) console.log("self.inputvar.files[0]"+self.inputvar.files[0]) self.freader = __new__(FileReader()) self.freader.onload = self.processInput() self.freader.readAsDataURL

Resize image before submit the form html5

前提是你 提交于 2019-12-24 01:44:13
问题 I need to resize an image in the client and add it to the form before submit. Here is the full html: <html> <body> <form action="url"> <label><b>Avatar image:</b></label> <input type="file" id="imageLoader" name="avatar" onchange="return ShowImagePreview( this, 0 );" /><br /> <canvas id="imageCanvas" class="previewcanvas" width="133" height="100"></canvas> <br /> <input type="submit" value="Save" /> </form> <script> var imageLoader = document.getElementById('imageLoader'); function

Why is this FileReader onload not firing?

六眼飞鱼酱① 提交于 2019-12-23 19:33:46
问题 I am starting with this working JavaScript code: // Begin File Open Code. function fileOpen() { var fileInput = document.getElementById('fileInput'); var fileDisplayArea = document.getElementById('iDisplay'); fileInput.addEventListener('change', function(e) { file = fileInput.files[0]; var imageType = /image.*/; if (file.type.match(imageType)) { var reader = new FileReader(); reader.onload = function(e) { iDisplay.innerHTML = ""; image = new Image(); image.src = reader.result; image.id = "I";

JavaScript readAsDataurl is not a function

不羁的心 提交于 2019-12-23 09:32:05
问题 In Gecko/Firefox I got the error message: TypeError: fr.readAsDataurl is not a function Using the following JavaScript: var fr = new FileReader(); fr.readAsDataURL(files[i]); 回答1: As it turns out someone at Mozilla created the deprecated method readAsDataurl with the improper letter casing and since JavaScript is case sensitive I simply had to use the readAsDataURL method (uppercase URL): if (fr.readAsDataURL) {fr.readAsDataURL(files[i]);} else if (fr.readAsDataurl) {fr.readAsDataurl(files[i]