Help: Video from Camera to FormData

#1

Hello fellow Ioners,

I was wondering if someone could help me how to approach this.
I’m capturing a video with cordova media-capture plugin, and I wish to transmit it with other data via a ‘FormData’ object as multipart form.

But the media-capture plugin exports this information:
“Video Recorded. Result:
[{“name”:“20160710_195724.mp4”,“localURL”:“cdvfile://localhost/sdcard/DCIM/Camera/20160710_195724.mp4”,“type”:“video/mp4”,“lastModified”:null,“lastModifiedDate”:1468195046000,“size”:2731528,“start”:0,“end”:0,“fullPath”:“file:/storage/emulated/0/DCIM/Camera/20160710_195724.mp4”}]”,

I need to transfer the file into FormData object, but FormData requires a ‘File’ object.
How do I approach turning a file from its path to ‘File’ object? The element does not seem to be able to accept a path programmatically so I can retrieve the ‘File’ object.

I’m looking into cordova-file-plugin, but have did not made it to work yet.
Am I on the right track, or there is a simpler approach to do it?

Thank you in advance
Costas

#2

Hello. Anyone on this?

I have been trying all this time to find a solution, but nothing worked.

I need to create a new ‘File’ object (like the one the ‘Input’ element provides, when you choose a file), but I don’t want to involve user interaction. I need to read a video file from storage, and then add add it to a FormData object.

Has anyone done this before?
I’m getting desperate here :sob:

Thank you in advance

Costas

#3

same problem with me :frowning: