file uploadの際にこれも使う。

https://developer.mozilla.org/ja/docs/Web/Guide/Using_FormData_Objects

emberjsでfileupload

FileReader.readAsDataURL

https://developer.mozilla.org/en-US/docs/Web/API/FileReader.readAsDataURL

Fileを読み込んでん画像を表示

<input type="file" onchange="previewFile()"><br>
<img src="" height="200" alt="Image preview...">
function previewFile() {
  var preview = document.querySelector('img');
  var file    = document.querySelector('input[type=file]').files[0];
  var reader  = new FileReader();

  reader.onloadend = function () {
    preview.src = reader.result;
  }

  if (file) {
    reader.readAsDataURL(file);
  } else {
    preview.src = "";
  }
}

with Rails carrierwave

base64でencodeされたファイルをサーバ側で受け取って保存する方法

http://stackoverflow.com/questions/6718841/restful-file-uploads-with-carrierwave

results matching ""

    No results matching ""