0

Is there a way to instantiate a JavaScript video file for upload as if it were a file input?

I need to upload a local server file through the YouTube Upload API using the file's URL (essentially trying to automatically upload files from our server to YouTube on behalf of our clients).

I've attempted to upload the following:

FileToUpload = new File([text], "Trial.mp4", {type: "video/*"});

where text is a array buffer from an xttp request.

However, process always results in "Upload failed: cannot process file". YouTube API seems to work only with <input type=file/> selector.

Essentially, the following is not possible:

document.getElmentById("myfile").files[0] = FileToUpload;

But YouTube Upload API seemingly will not taking any other form with JavaScript.

I've been searching for over a month now and been unsuccessful. Any help would be greatly appreciated.

plamut
  • 3,085
  • 10
  • 29
  • 40

0 Answers0