VaRest icon indicating copy to clipboard operation
VaRest copied to clipboard

Add support for content-type "multipart/form-data; charset=utf-8;"

Open ufna opened this issue 7 years ago • 6 comments

ufna avatar Jul 20 '16 05:07 ufna

Multipart/form-data is for file uploads but is possible by code.

https://support.gamesparks.net/support/discussions/topics/1000079052

saidmoya12 avatar Aug 23 '17 16:08 saidmoya12

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;
}`

oppne avatar May 15 '19 08:05 oppne

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.

TM818 avatar Sep 25 '20 14:09 TM818

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!

kevinawaydigital avatar Jul 12 '21 13:07 kevinawaydigital

@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 image

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 image

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? :)

shirkan164 avatar Jul 03 '22 23:07 shirkan164

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

chrispavlopoulos avatar Feb 17 '24 16:02 chrispavlopoulos