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 /
  • General Discussion /
avatar image
Question by JJ · Jan 15 at 01:04 AM · CloudScriptCustom Game Serversdatagame managerShared Group Data

Allowing User to Save Images/Audio/Video File on Playfab

Hi, I am aware that there is already another question that spoke about this, and Brendan mentioned that user are unable to upload image/audio/video file.

Since that is very long ago, may I clarify if this is still true? If yes, how can I work around it? My game allow user to send images to each other - so I have been working on SharedGroupData recently, and managed to add both the sender and receiver in a sharedgroupdata.

In this context, do I add the image within the sharedgroupdata or where should I save the image to make it logically clear that it belongs to both sender and receiver only?

P.S. Asking in advanced - if the answer is external database, may I clarify how it works? I saw a post talking about grabbing the EntityToken to which we can send to our MAMP server - but that deals with authetication. How can we make the data consistent between playfab and our external db? Suppose a new user is created using playfab, do i have to update the data in our external db?

Comment

People who like this

0 Show 1
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 JJ · Jan 15 at 01:09 AM 0
Share

Adding on to this question - as I am a student doing a project for my Final Year Project, I really want to minimize my cost. I remember that Brendan mentioned the cost is $0.10 per gb downloaded - I would love to hear the updated cost and what is a realistic cost if I am merely sending <20 average size image/file/audio simply for testing and final presentation.
Cheers!

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Jan 15 at 01:26 AM

These days, we have the Entity File system available for arbitrary data you want to save (including binaries). So it's certainly possible for you to let clients upload any file type you like. The thing I would caution you around is that regardless of your intent, if you allow a client to upload and download arbitrary files, it's trivially easy for a hacker to repurpose your title to distribute any content they want to. Which could very rapidly run up your costs considerably. So we would strongly recommend having a server process that checks the content for validity before it is accepted. You could, for example, have a process for ingesting content that triggers an Azure Functions Cloud Script to check that content once it is uploaded, or run a custom game server that does this. You would then only allow "good" content to be finalized.

If you are sharing data between a (very) small number of players, you could use Shared Group Data, but I would recommend moving to the newer Group Entity. A Group Entity could have Entity Objects that define the Entity Files available (whether the Files belong to the player or the Group).

Costs for this would be based on usage. The $0.10 per GB downloaded cost is for CDN usage. Rather than use that, I would point you to the meters usage pricing docs:

Pricing Meters - PlayFab | Microsoft Docs

PlayFab Consumption Best Practices - PlayFab | Microsoft Docs

Those have all the details you need to work out what the costs would be, given the total usage you have in mind.

Comment
JJ

People who like this

1 Show 4 · Share
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 JJ · Jan 15 at 11:59 AM 0
Share

Hi Brendan. Thanks for the answer, I finally made good progress after looking at Entity File System. I hesitated to post a reply because I wanted to ensure I have really tried my hands on various problem first.

I'm currently able to save the file to the user's file entity, the problem I have now is regarding the naming convention. As I am trying to "link" some data along with the image (The use case is akin to PlayerA sending a picture to PlayerB with some caption)

From my research, I don't think the Entity File System actually support additional data, so what I'm trying to do now is updating the player's title data with the name of the file as the "foreign key".

Meaning my player title data would probably have something like

Message {
    "SendFrom": "PlayerA-Username", "PictureName": "myPicture", 
"SentDate": "SomeDate"
}

And my picture file would be

myPicture.

I haven't fully tested this but I'm sure this will work. However, I can't use this method continuously since the picture name is hard-coded. Do you have any suggestion how I can work around this? And is my current working method even correct?

avatar image Brendan ♦♦ JJ · Jan 15 at 05:56 PM 0
Share

Yes, the Entity File system is simply that - a way to save a file (no extra metadata). But it is an arbitrary file, so why not just have the metadata for your message be in the file itself? Just add your metadata to the start or end of the file, and have the client strip that out when it downloads it? Another alternative would be to write this data into an Entity Object.

avatar image JJ Brendan ♦♦ · Jan 16 at 01:24 AM 0
Share

Hmm, I'm actually saving a picture/image file, wouldn't appending the metadata affect the file?
Furthermore, since user will be able to upload these files, and enter some input (i.e. they can enter a caption for each image they send), wouldn't that be a security risk if a user writes some malicious code and I append it to the file?

Anyways
Regarding Entity Object, are you referring to writing the file data to the entity object along with the metadata, or just adding the metadata into the entity object?

Show more comments

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

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Best practices for versioning title data and Azure Functions 1 Answer

    SharedGroupData Notification on Desktop 1 Answer

    ExecuteCloudScript Errors - 'ExecuteCloudScriptResult' does not contain a definition 0 Answers

    C# Server,C# Server! 2 Answers

    How to set a string of all player's user data to 0 by cloud script? 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