Hi there, I'm recently having problems uploading files with the Entity API while it seemed to work before.
I managed to replicate the behavior with a small piece of code:
byte[] bytesData = new byte[saveData.Length * sizeof(char)]; System.Buffer.BlockCopy(saveData.ToCharArray(), 0, bytesData, 0, bytesData.Length); EntityKey entity = ((AndroidPlatform)Platform.GetInstance()).CurrentEntityKey; var initiateFileUploadsRequest = new InitiateFileUploadsRequest { Entity = entity, FileNames = new List<string> { "AllFiles.json" }, }; PlayFabEntityAPI.InitiateFileUploads(initiateFileUploadsRequest, (InitiateFileUploadsResponse response) => { Debug.Log("PlayFabTest: InitiateFileUploads success!"); byte[] payload = bytesData; PlayFabHttp.SimplePutCall(response.UploadDetails[0].UploadUrl, payload, () => { Debug.Log("PlayFabTest: SimplePutCall success!"); var finalizeFileUploadsRequest = new FinalizeFileUploadsRequest { Entity = entity, FileNames = new List<string> { "AllFiles.json" }, }; PlayFabEntityAPI.FinalizeFileUploads(finalizeFileUploadsRequest, (FinalizeFileUploadsResponse finalizeFileUploadsResponse) => { Debug.Log("PlayFabTest: Finalize success!"); }, (PlayFabError err) => { Debug.Log("PlayFabTest: Finalize failed! " + err); }); }, (string err) => { Debug.Log("PlayFabTest: SimplePutCall failed! " + err); }); }, (PlayFabError err) => { Debug.Log("PlayFabTest: InitiateFileUploads failed! " + err); });
The problem I'm having is that it seems I cannot finalize the upload of a file, when a file with the same name already exists. This wasn't an issue before and only started occurring recently. When I make sure the file doesn't already exist this is logged:
PlayFabTest: InitiateFileUploads success! PlayFabTest: SimplePutCall success! PlayFabTest: Finalize success!
When the file already exists I get this:
PlayFabTest: InitiateFileUploads success! PlayFabTest: SimplePutCall success! PlayFabTest: Finalize failed! /File/FinalizeFileUploads PlayFabError(FileNotFound, The file AllFiles.json was not found by the storage provider. It must finish being uploaded before finalize can be called., 400 BadRequest)
It's odd that I get a FileNotFound error, even though I just initiated uploading that file and successfully finished uploading it. Am I missing something?