Is it possible to make a request POST
by sending a file as a parameter?
For example the TinyPic site contains a field of type file
, and I want to send a direct image of my application to TinyPic.
Is it possible to make a request POST
by sending a file as a parameter?
For example the TinyPic site contains a field of type file
, and I want to send a direct image of my application to TinyPic.
Yes, you can make POST requests via JavaScript using XMLHttpRequest , common AJAX.
However, it is not possible to send an image to TinyPic in this way because this characterizes Cross-Site Scripting (XSS): you are trying to post a form from an A domain (your site) to a B (tinypic) . This could only happen if TinyPic included your domain in the X-Allow-Origin header. .
You can upload TinyPic images from your site through the service plugin . They place an iframe on your page, that's fine, because inside the iframe is a page with the domain tinypic.com
.