When sending a GetUploadUrlRequest you can pass an uploadData parameter (API Reference). The description says: "Optional meta data which is stored against the player’s uploaded content"
How / where is this data stored and how can you access it?
Thanks in advance,
Jannis
Best Answer
C
Customer Support
said
over 6 years ago
Hi Jannis,
The uploaded file details are currently stored in a system collection that is not exposed to users. You can however build a custom runtime collection to keep a record of these files yourself. You can do this by placing the the following code in Cloud Code>User>UploadCompletedMessage.
//grab the uploaded files details from the message
var dataToGrab = Spark.getData().uploadData;
//load our collection
var uploadedFiles = Spark.runtimeCollection("uploadedFiles");
//insert the data into our custom runtime collection
var success = uploadedFiles.insert({"uploadedData":dataToGrab})
With this you will end up with a mirrored collection containing a document each uploaded file.
Just remember that if you use the "deleteUploadedFile" call from SparkFiles to remove an uploaded file, remember to remove the corresponding document from your custom collection while you are doing it, this will keep the collection up to date. If you have any further questions just let me know.
Thanks,
Liam
1 Comment
Customer Support
said
over 6 years ago
Answer
Hi Jannis,
The uploaded file details are currently stored in a system collection that is not exposed to users. You can however build a custom runtime collection to keep a record of these files yourself. You can do this by placing the the following code in Cloud Code>User>UploadCompletedMessage.
//grab the uploaded files details from the message
var dataToGrab = Spark.getData().uploadData;
//load our collection
var uploadedFiles = Spark.runtimeCollection("uploadedFiles");
//insert the data into our custom runtime collection
var success = uploadedFiles.insert({"uploadedData":dataToGrab})
With this you will end up with a mirrored collection containing a document each uploaded file.
Just remember that if you use the "deleteUploadedFile" call from SparkFiles to remove an uploaded file, remember to remove the corresponding document from your custom collection while you are doing it, this will keep the collection up to date. If you have any further questions just let me know.
Jannis B
Hi,
When sending a GetUploadUrlRequest you can pass an uploadData parameter (API Reference). The description says: "Optional meta data which is stored against the player’s uploaded content"
How / where is this data stored and how can you access it?
Thanks in advance,
Jannis
Hi Jannis,
The uploaded file details are currently stored in a system collection that is not exposed to users. You can however build a custom runtime collection to keep a record of these files yourself. You can do this by placing the the following code in Cloud Code>User>UploadCompletedMessage.
With this you will end up with a mirrored collection containing a document each uploaded file.
Just remember that if you use the "deleteUploadedFile" call from SparkFiles to remove an uploaded file, remember to remove the corresponding document from your custom collection while you are doing it, this will keep the collection up to date. If you have any further questions just let me know.
Thanks,
Liam
Customer Support
Hi Jannis,
The uploaded file details are currently stored in a system collection that is not exposed to users. You can however build a custom runtime collection to keep a record of these files yourself. You can do this by placing the the following code in Cloud Code>User>UploadCompletedMessage.
With this you will end up with a mirrored collection containing a document each uploaded file.
Just remember that if you use the "deleteUploadedFile" call from SparkFiles to remove an uploaded file, remember to remove the corresponding document from your custom collection while you are doing it, this will keep the collection up to date. If you have any further questions just let me know.
Thanks,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics