0

I'm trying to create a HTML form to upload an image with encoding type - multipart/form-data.

I've been instruted to use an 'Origin' header with the value 'https://some-url.com' and a 'Host' header with the value 'image-upload.amazonaws.com'

But I can figure out where to specify the'Origin' header.

My HTML looks this this:

<!DOCTYPE html>
<html lang="en"> 
<head>
  <meta charset="utf-8"/>
  <title>upload image file</title>
</head>
<body>
<form action="image-upload.amazonaws.com" method="post" enctype="multipart/form-data">
  <p><input type="text" name="key" value="async_uploads/123456789-987654321">
  <p><input type="text" name="success_action_status" value="201">
  <p><input type="text" name="policy" value="sdfghjsdfg8sdfgshdfgjksg=">
  <p><input type="text" name="x-amz-credential" value="DSFGHJSDFGH?878dfg78">
  <p><input type="text" name="x-amz-algorithm" value="AWS4-HMAC-SHA256">
  <p><input type="text" name="x-amz-date" value="20180620T022620Z">
  <p><input type="text" name="x-amz-signature" value="sdg678sdfg7h34">
  <p><input type="file" name="myimage.png">
  <p><button type="submit">Submit</button>
</form>
</body> 
</html>

Can anyone help me?

Thanks in advance...

Victor
  • 13
  • 4
  • do you have your own (apache) hosting? if so you can do it your htaccess file.. look at this https://stackoverflow.com/a/29774990/1675954 for other methods (php) .. i'd avoid the chrome hack.. – Rachel Gallen Jun 28 '18 at 00:18

1 Answers1

0

Host - the domain name where the request is being sent to. Origin - shows the domain/Url from where the request was initiated(or originated)

https://www.codeproject.com/Articles/185506/AJAX-Cross-Origin-HTTP-request. This Wiki page shows the list of all header fields

So, you need to include the Origin in the request header. See this example, https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin.

Hope this helps,

Swinkaran
  • 1,207
  • 1
  • 12
  • 19
  • Thanks for your advice. I had a look at the links, so from what I understand there's no way I can do it just with the html? – Victor Jun 28 '18 at 01:19
  • Correct. You need to use a server side language like C#, PHP, VB.. etc. HTML is simply a markup language. – Swinkaran Jun 28 '18 at 01:59