Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by YuKim · May 21, 2019 at 08:24 AM · unity3dContent

I make project mesh upload Donwload project and error is occured upload download

I make project mesh upload Donwload project and error is occured upload download

uploading succesfully but i don't know downloading

I convet mesh to binary file and upload

I download binary file and convert binary to mesh

2 error

1.I uploaded file but website Gamemanger/content/filemangement is not displayed

2. I download file but I do not know whether it is the correct file or not

i think that is not correct file

the reason is MeshSerializer doesn't work

MeshSerailizer worked fine without upload,download

This is upload cord

public void UploadFileToCDN
(string key, byte[] content, string contentType = "binary/octet-stream")
    {
        GetUploadUrl(key, contentType, presignedUrl =>
        {
            PutFile(presignedUrl, content, contentType);
        });
    }


    void GetUploadUrl(string key, string contentType, Action<string> onComplete)
    {
        PlayFabAdminAPI.GetContentUploadUrl(new GetContentUploadUrlRequest()
        {
            ContentType = contentType,
            Key = key
        }, result => onComplete(result.URL),
        error => Debug.LogError(error.GenerateErrorReport()));
    }
 void PutFile(string presignedUrl, byte[] content, string contentType = "binary/octet-stream")
    {
        List<IMultipartFormSection> formData = new List<IMultipartFormSection>();
        formData.Add(new MultipartFormDataSection("field1=foo&field2=bar"));
        formData.Add(new MultipartFormFileSection(content));

        UnityWebRequest www = UnityWebRequest.Post(presignedUrl, formData);


        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log("Form upload complete!");
        }
    }

this is cord Download cord

 public void DownloadFileFromCDN(string key)
    {

        GetDownloadUrl(key, presignedUrl =>
        {
          MeshSerializer.DeserializeMesh(GetFile(presignedUrl), GetComponent<MeshFilter>().mesh);
        });
    }


    void GetDownloadUrl(string key, Action<string> onComplete)
    {
        PlayFabClientAPI.GetContentDownloadUrl(new GetContentDownloadUrlRequest()
        {
            Key = key,
            ThruCDN = true
        }, result => onComplete(result.URL),
        error => Debug.LogError(error.GenerateErrorReport()));
    }


    byte[] GetFile(string preauthorizedUrl)
    {
        UnityWebRequest www = UnityWebRequest.Get(preauthorizedUrl);
        // yield return www.SendWebRequest();


        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
            return null;
        }
        else
        {
           byte[] results = www.downloadHandler.data;
            return results;
        }
        
    }


2211.png (9.9 kB)
Comment

People who like this

0 Show 6
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SethDu ♦ · May 21, 2019 at 08:45 AM 0
Share

Have you called API FinalizeFileUploads after the upload? https://docs.microsoft.com/en-us/rest/api/playfab/data/file/finalizefileuploads?view=playfab-rest

According to the Documentation: after using the upload calls FinalizeFileUploads must be called to move the file status from pending to live.

avatar image YuKim SethDu ♦ · May 22, 2019 at 02:37 AM 0
Share

Thank you for asking

use FinalizeFileUploads error is occured .

how to solve this error?

english is very hard language

i really appreciate you responding even if I write English strangely.

this is error part

PlayFabAuthenticationAPI.GetEntityToken(new GetEntityTokenRequest(),(entityResult) =>
        {
            entityId = entityResult.Entity.Id;


            Debug.Log(entityResult.Entity.Id);
            entityType = entityResult.Entity.Type;
            PlayFab.DataModels.FinalizeFileUploadsRequest finalizeFileUploadsRequest = new PlayFab.DataModels.FinalizeFileUploadsRequest
            {
                Entity = new PlayFab.DataModels.EntityKey { Id = entityId, Type = entityType },
                FileNames = Keyname
            };


            PlayFabDataAPI.FinalizeFileUploads(finalizeFileUploadsRequest, OnUploadSuccess, OnSharedFailure);


        }, OnPlayFabError);

1111.png (23.0 kB)
avatar image SethDu ♦ YuKim · May 22, 2019 at 02:54 AM 0
Share

Can you print out the "entityType"?

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    4 People are following this question.

    avatar image avatar image avatar image avatar image

    Related Questions

    How to download content from cdn? 1 Answer

    CDN upload is not work 1 Answer

    GetContentDownloadUrl download file failed access denied 1 Answer

    Slow response times 1 Answer

    Best Approach for getting leaderboards (Login by FB) 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges