0

I have to upload a file using input tag <input type="file"> and send the file or file content through to other domain(cross domain).Can i make use of javascript jsonp request to send file to a cross domain ? It is mandatory to use pure javascript not jquery or angularjs

Is jsonp is the best method to send data(file object/file content) to a cross domain?

Here is my code

<input type='file' id='files' name='myfiles'/>

function handleFileSelect(evt) {
    var files = evt.target.files; // FileList object
    console.log(files)
    var s = document.createElement("script");
    s.src = "http://192.168.100.115:8700/is_selected/";
    document.body.appendChild(s);

  }

  document.getElementById('files').addEventListener('change', handleFileSelect, false);
akhil viswam
  • 496
  • 9
  • 24

0 Answers0