First of all, please understand that I am not fluent in English.
i'm using unity project with playfab.
currently i am trying to upload small png file to players Files section(players->files) by using PlayFabDataAPI.InitiateFileUploads. but restriction allows only A-Z, a-z, 0-9 and the special characters '.', '_', '-', '(' and ')'. is it possible to upload png file to that section via code?
#(Solved)Question about PlayFabDataAPI.InitiateFileUpload
3 messages · Page 1 of 1 (latest)
I have found problem and problem was that InitiateFileUploads sets just filename and actual contents can be attached at succese callback's PlayFabHttp.SimplePutCall sequence.
heres sample method ive tested and it works well.
void OnInitFileUpload(PlayFab.DataModels.InitiateFileUploadsResponse response)
{
byte[] fileData = new byte[0];
//path is specific directoy path seted before
if (File.Exists(string.Format("{0}/{1}", path, "file1.png")))
{
fileData = File.ReadAllBytes(string.Format("{0}/{1}", path, "file1.png"));
Debug.LogWarningFormat("File.Exists {0}", fileData.Length);
}
else {
Debug.LogError("file is null");
return;
}
GlobalFileLock += 1; // Start SimplePutCall
PlayFabHttp.SimplePutCall(response.UploadDetails[0].UploadUrl,
fileData,
FinalizeUpload,
error => { Debug.Log(error); }
);
GlobalFileLock -= 1; // Finish InitiateFileUploads
}