Server side image uploads
- Dominant language
- Elixir
- Stars
- 108
- Forks
- 20
- Avg merge
- 21h 46m
- Merged PRs (30d)
- 4
Description
We are trying to implement an image upload from our server.
We need to replicate the form submit from the [direct-upload example](https://github.com/dwyl/image-uploads/blob/master/examples/direct-upload/public/client.js#L34) on the back end but we're having trouble structuring our http POST request.
The form data that we want to send are the [params](https://github.com/dwyl/image-uploads/blob/master/examples/direct-upload/generate-credentials.js#L19) returned from our `getS3Credentials` function.
The url of the form is the [endpoint url](https://github.com/dwyl/image-uploads/blob/master/examples/direct-upload/generate-credentials.js#L18) from the same function.
Our form looks like this:
``` html
Submit
```
And this is what we're dynamically adding before we submit the form:
``` js
function buildAndSubmitForm (s3Data) {
var form = document.querySelector('form')
var keyInput = document.createElement('input')
keyInput.setAttribute('type', 'hidden')
keyInput.setAttribute('name', 'key')
keyInput.setAttribute('value', s3Data.filename)
form.setAttribute('method', 'post')
form.setAttribute('action', s3Data.endpoint_url)
form.setAttribute('enctype', 'multipart/form-data')
form.insertBefore(keyInput, form.firstChild)
form.url = s3Data.endpoint_url
form.formData = s3Data.params
form.submit()
}
```
Does anyone know how our POST request should look in order for our form data to be sent in the same fashion as our front end example?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.