I'm trying to upload an image with PubNub API in Ruby on Rails.
This is the input to upload the image and a button to call the function testf()
= file_field_tag "image", accept: 'image/jpeg, image/png', id: 'image_submit', name: "input[file]"
button onclick="testf()" test
javascript:
const input = document.querySelector('#image_submit');
function testf(){
const [file] = input.files;
pubnub.sendFile({
channel: 'my_channel',
file: file,
})
}