How upload file to extrernal site?


#1
  1. Load extrenal website in windowBrowser with js injection
  2. using javascript I’m click on and FileDialog oppened/
    How can I programmatically load an external website the file from your computer ?

#2

Is this a question about Atom, the text editor, or Electron, the app framework?


#3

it is about electron


#4

Electron is based on Chromium, so basic browser API calls should generally work the same way. Since it also has Node built in, you can also get files with the fs module.


#5

Thank you, but I want to programmatically insert a file in from external site (it is not my site and I can’t do it using the ways given above).


#6

In the subject, you asked how to upload a file to an external site, not to get a file from one.

It probably depends what the site is.


#7

Site is vk.com, i want open it in electron and upload photo there using js in electron


#8

You’ll want to do it with the VK.com API.


#9

Yes, I think it would have… But did not want to use the api, the goal was to emulate user actions.Are you sure that no more way to get about this behavior in electron ? (as in selenium webdriver http://stackoverflow.com/questions/11256732/how-to-handle-windows-file-upload-using-selenium-webdriver) ?


#10

You could load the site and simulate click events.


#11

vk.com api does not provide methods for working with audio files =(

I can simulate click events for open file dialog for to select the file, but how can I, after opening the fileDialog to choose a file from my computer ?


#12

I don’t know.


#13

@borzovplus
I am not sure this will work or not if you have free time just give a try, manually upload data and check what information is posted by front end to back end.
try to reconstruct that url and hit the URL.

Sample:

var myimage_url = ‘https://avatars.discourse.org/v2/letter/b/a5b964/120.png

https://images.google.com/searchbyimage?image_url="+encodeURI(myimage_url)+"&encoded_image=&image_content=&filename=&hl=en

This will do image search in google, without selecting /uploading image