question

sebastien-1 avatar image
sebastien-1 asked

Upload file to Player's account - Unreal

Hello,

I want to upload a .png file to a player account. But I get this error when I try to finalize the file uploads:

LogPlayFab: Response : {"code":500,"status":"InternalServerError","error":"InternalServerError","errorCode":1110,"errorMessage":"An unexpected error occured while processing the request.","errorHash":"d6a3d9857a4eae7bf42c07665ffc661d","errorDetails":{"RequestID":["1-5f3d2607-eed995581ac6555828e2b19c"]}} LogBlueprintUserMessages: [TopNavBar_C_0] RequestID: 1-5f3d2607-eed995581ac6555828e2b19c

I did follow the documentation, I did a "Get entity token", then a "Initiate file uploads", and I finally did "finalize file uploads".

I just don't get how the "request entity" object is made in Unreal. I have logged in using the playfab email and password.

But how do I get the "request entity" object?

My goal is to upload an image file to the player's account, so that I can then use it as his/her profile picture.

Thank you.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

We are not sure why you get the InternalServerError when you try to finalize the file uploads. “Entity” parameter is also required when you call API InitiateFileUploads. If you haven’t passed the “Entity” in the request body of InitiateFileUploads. This API InitiateFileUploads should return error “InvalidParams”. If you call the API FinalizeFileUploads in this situation, it would return error “NoEntityFileOperationPending”.

So did you get the “UploadUrl from the InitiateFileUploads’s response, and upload the file successfully before you call FinalizeFileUploads?

You can refer to the following testing blueprints to get the “request entity” in the response of login API and use it to invoke InitiateFileUploads. Please feel free to post them if you have other questions.


6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sebastien-1 avatar image sebastien-1 commented ·

Hi Sarah,

Thank you for your reply!

The filename string I'm using is:

../../../../../../Users/PlayfabFiles/Profile.png

Now I get a success for the initialisation, but the finalize is not a success.

What should I use for the finalize node input filename? The FileName field or the UploadUrl field response from the initiate node?

This is my setup:

0 Likes 0 ·
fileupload.png (174.6 KiB)
sebastien-1 avatar image sebastien-1 commented ·

And I did get the UploadUrl from the InitiateFileUploads. But the UploadUrl is not used as a filename for the finalizeFileUploads right?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang sebastien-1 commented ·

No, UploadUrl is not the file name you need to use in the FinalizeFileUploads. When you call the InitiateFileUploads. You need to define a file name in the request body. For example. "gameState","avatar", etc. As our documentation says, you need to use the REST method "put" to upload the file to the UploadUrl. (The sample code is using Unity C#, but it shares the similar pseudo code as the Unreal.) After you use "put" request upload the file, you can use the file name and entity to call FinalizeFileUploads.

1 Like 1 ·
sebastien-1 avatar image sebastien-1 Sarah Zhang commented ·

Thank you for your reply Sarah,

It is now clear that i missed 1 step inbetween the initiate and finalize.

I didn't get the fact that Initiatefileupload and finalizefileupload are not uploading anything..

The problem I see is why there is no SimplePUT node blueprint in Unreal?

Thank you. Seb

0 Likes 0 ·
Show more comments
sebastien-1 avatar image
sebastien-1 answered

Thank you for your reply, indeed I ended up using this varest plugin for the put http request. But there's still the conversion of an image to bytes which blocks me. So the whole process works with a text string. But whit a Texture image in Unreal I can't convert it to bytes..

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image Sarah Zhang commented ·

For such technical questions about Unreal native methods. You can try to search for them or post a question in the Unreal Engine Answer Hub for the more professional supports.

2 Likes 2 ·
sebastien-1 avatar image sebastien-1 Sarah Zhang commented ·

Yes, I am asking them about that. Thank you anyway for your help, very informative! I hope that this thread will help some other Unreal users. Thanks.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.