且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

回答我自己的问题......

更新时间:2023-12-02 17:53:58

出于某些保护原因和/或特殊性,有时其他一些代码可以用来做(解决方案编号3),然后我从带有webrick服务器的rails 4框架(适用于firefox 25和chrome 29,而不是on Safari):





 function readURL(){
var input = document.getElementById(' FilePhoto');
var fReader = new FileReader();
fReader.readAsDataURL(input.files [ 0 ]);
fReader.onloadend = function( event ){
var img = document。 getElementById( blah);
img.src = event .target.result;
}
}





(不需要函数事件调用...来自文件celetion字段的onchange选项没问题,而且,从事件中调用的函数不需要varthis



来自chakroun yesser的解决方案,这里:http://***.com/questions / 4851595 /如何对解决最C-fakepath> HTTP://***.com/questions/4851595/how-to-resolve-the-c-fakepat


so... my code has no error, i just use yours (who is not bad on some use) without success (but you choose to judge so quick, so strong...), but for some protect reason and/or specificities, sometimes some other codes can works for do it (solution number 3), and then i'm from rails 4 framework with webrick server (works on firefox 25 and chrome 29, not on Safari):


function readURL() {
  var input = document.getElementById('FilePhoto');
  var fReader = new FileReader();
  fReader.readAsDataURL(input.files[0]);
  fReader.onloadend = function(event){
  var img = document.getElementById("blah");
  img.src = event.target.result;
  }
}


(no need function event call... "onchange" option from file celetion field is ok, and also, no need var "this" on function called from event)

Solution from chakroun yesser, here: http://***.com/questions/4851595/how-to-resolve-the-c-fakepath">http://***.com/questions/4851595/how-to-resolve-the-c-fakepat


so... i hope some other peoples from your team could said you to go slowly before judge other people so quickly and so strongly, and try to go back school for understand how is construct a question... (and so... it is really a shame...).
If you don't know guys, just said: I'm sorry, i don't know.

for some protect reason and/or specificities, sometimes some other codes can works for do it (solution number 3), and then i'm from rails 4 framework with webrick server (works on firefox 25 and chrome 29, not on Safari):


function readURL() {
  var input = document.getElementById('FilePhoto');
  var fReader = new FileReader();
  fReader.readAsDataURL(input.files[0]);
  fReader.onloadend = function(event){
  var img = document.getElementById("blah");
  img.src = event.target.result;
  }
}



(no need function event call... "onchange" option from file celetion field is ok, and also, no need var "this" on function called from event)

Solution from chakroun yesser, here: http://***.com/questions/4851595/how-to-resolve-the-c-fakepath">http://***.com/questions/4851595/how-to-resolve-the-c-fakepat