Skip to content

Commit e4705ef

Browse files
z-xsimplykatsa
andauthored
Added information about Content-Type (#1758)
* Added information about Content-Type * Upd * Typo * Update app/views/pages/developer-guide/user-uploads/user-uploads.liquid Co-authored-by: Alex Pozsár <[email protected]> * Update app/views/pages/developer-guide/user-uploads/user-uploads.liquid Co-authored-by: Alex Pozsár <[email protected]> * Updated wording --------- Co-authored-by: Alex Pozsár <[email protected]>
1 parent 402a4ef commit e4705ef

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/views/pages/developer-guide/user-uploads/user-uploads.liquid

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ properties:
5959
```liquid
6060
{% graphql data %}
6161
mutation presign {
62-
property_upload_presigned_url(table: "documents", property_name: "resume") {
62+
property_upload_presigned_url(table: "documents", property_name: "resume", include_content_type: true) {
6363
upload_url
6464
upload_url_payload
6565
}
@@ -69,11 +69,20 @@ properties:
6969
{% for field in data.property_upload_presigned_url.upload_url_payload %}
7070
<input type="hidden" name="{{ field[0] }}" value='{{ field[1] }}'>
7171
{% endfor %}
72+
<input type="hidden" name="Content-Type" value="application/pdf">
7273
<button type="submit">Upload</button>
7374
</form>
7475
```
7576
{% endraw %}
7677

78+
One additional thing that you would probably want to send with the payload is the `Content-Type` of the uploaded file. In the example, it is shown with a hardcoded value of `application/pdf`.
79+
80+
Usually, you would like to update this information dynamically in the front-end after user chooses the file. This typically requires a small amount of custom JavaScript, depending on your implementation.
81+
82+
It is possible to skip the `Content-Type`, but this will result in a default value of `application/octet-stream` being set.
83+
84+
85+
7786
3. S3: Return URL to file
7887
After submitting such form, you will be redirected to an XML response (204 status code) with the URL to the file on the storage servers. Otherwise it will return status 4xx and the reason for the error in XML format.
7988

@@ -119,6 +128,8 @@ query get_documents {
119128
If you want your users to be able to upload images and automatically generate multiple versions of it (for example a thumbnail) you can achieve it by using the `versions` option of property upload.
120129
Read more on how to [implement image upload with version processing using Direct S3 upload and Uppy](/developer-guide/user-uploads/uploading-files-directly-amazons3-using-uppy).
121130

131+
Additionaly, when `versions` option is set, it is possible to skip setting the `Content-Version` metadata as mentioned above. In this case, the system assumes the file is an image, and the image processing software will set it automatically.
132+
122133
## FAQ
123134

124135
1. platformOS is multi-cloud, does this mean implementation will be different for every cloud provider?

0 commit comments

Comments
 (0)