Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 11 Monaten, 1 Woche
Letzter Beitrag:
vor 10 Monaten
Beteiligte Autoren:
Arekusei Timakobu, Fabrice Harari, KenKnight

[WB] Get uploaded data in AWP page (using for XMLHttpRequest)

Startbeitrag von Arekusei Timakobu am 15.09.2016 07:39

I need to upload some file on server using AJAX-request. Does anyone know if it is possible (in principle) to get uploaded data on target server? I mean how can I access it inside AWP-page.

Antworten:

Hi

the upload file is there for that (two versions, even)

Now if you want to do it entirely by code, the hard part is to access the local file (possible in html 5/JS). After that, you can send anything to the server using ajaxexecute, as long as you encode
/decode it properly.

Best regards

von Fabrice Harari - am 15.09.2016 11:23
Hi, Fabrice.
The fact I already have a file locally (sound captured from microphone using WebRTC) and I need to send it remotely. From JS code I can only use XMLHttpRequest for that but it is impossible because Same Origin Policy that forbid to connect "alien" sites (different domain, IP or port). That is why I need an additional intermediate layer (script on my site that upload the file to another site - that is an idea). I could do this using PHP because I have $_FILES array where I can find uploaded files but I am interested if it is possible in WebDev... And it seems it is impossile.

von Arekusei Timakobu - am 15.09.2016 12:49
Hi

as I told you before, it IS possible... the ONLY hard part is to get the local file in the browser code. Once you have it, you put it ina buffer, encode it i n base 64 then send it to the server with ajaxexecute

Best regards

von Fabrice Harari - am 15.09.2016 14:10
Hi Arekusei,

You may want to read up on origin headers and pre-flight requests. I'm currently doing requests that under normal circumstances are blocked by CORS, however, modifying headers etc, overrides those blocks.

Cheers!
Ken

von KenKnight - am 19.10.2016 15:03
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.