VaRest
VaRest copied to clipboard
Add support for content-type "multipart/form-data; charset=utf-8;"
Multipart/form-data is for file uploads but is possible by code.
https://support.gamesparks.net/support/discussions/topics/1000079052
Something like this?
`case ERequestContentType::Multipart_form_data: { HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/Multipart_form_data")); HttpRequest->SetURL(URL); HttpRequest->SetVerb("POST"); HttpRequest->SetContent(data);
TArray<uint8> data;
data.Append((uint8*)TCHAR_TO_UTF8(*a), a.Len());
data.Append((uint8*)TCHAR_TO_UTF8(*b), b.Len());
data.Append((uint8*)TCHAR_TO_UTF8(*c), c.Len());
data.Append(UpFileRawData);
data.Append((uint8*)TCHAR_TO_UTF8(*e), e.Len());
break;
}`
Just FYI, we still want this functionality, if it doesn't already exist. Not having multipart form upload support requires coders who (for example) want their users to be able to upload files to a remote API, to either code their own functions or install a different HTTP(S) plugin (something other than VaRest) for UE.
In node.js (the most popular API framework right now), the various modules that handle file uploads (such as mutler and formidable) expect multipart form data, for either small or large files. If VaRest still doesn't support this 4 years after the first time it was requested as a feature (2016), that's unfortunate.
Hi there, thumb up for this feature. Otherwise, please kindly show me how to upload file (pdf) to server with the current version. Ton of thanks!
@ufna is it possible to get this functionality?
Tested via Postman - it's possible to upload a file by adding body type form-data as file - doesn't work as x-www-form-urlencoded or any other option (otherwise it returns: internal server error)
This is the Setup in Postman that uploads a file to the external provider
But it's not possible using the Plugin cuz we can only provide f.ex. a String Field and it doesn't work and returns the internal server error instead, there's no "Set Body" node etc, the thing is that I want to POST with Body as form-data where value is a file.
The HTTP Request looks like this after saving from Postman
Maybe there's such an option but after many hours I wasn't able to achieve it, if it doesn't exists would it be possible from your side to update that? :)
I followed this tutorial which allowed me to create this functionality in a separate custom C++ Blueprint:
https://dev.epicgames.com/community/learning/tutorials/R6rv/unreal-engine-upload-an-image-using-http-post-request-c