Notifications
Clear all

Help With Uploads

4 Posts
2 Users
0 Reactions
1,043 Views
(@webbstre)
Posts: 21
Eminent Member
Topic starter
 

Hello Again!

I'm having some trouble getting the file uploading to work. I'm using the test script from the documentation:

byte[] screenshot = CombuManager.instance.CaptureScreenShot();
UserFile newFile = new UserFile();
newFile.sharing = UserFile.eShareType.Everybody;
newFile.Update(screenshot, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});

 

I've made sure to log in before trying to run this, but I always get the following (unhelpful?) errors:

{"success":false,"message":"An error occurred","errors":[]}
UnityEngine.Debug:Log(Object)
Combu.<DownloadUrl>c__Iterator1:MoveNext() (at Assets/_Ignore/Combu/Scripts/CombuManager.cs:278)

Failed: An error occurred
UnityEngine.Debug:Log(Object)
SaveLoad:<Save>m__0(Boolean, String) (at Assets/Scripts/SaveLoad.cs:28)
Combu.<Update>c__AnonStorey4C:<>m__55(String, String) (at Assets/_Ignore/Combu/Scripts/UserFile.cs:185)
Combu.<DownloadUrl>c__Iterator1:MoveNext() (at Assets/_Ignore/Combu/Scripts/CombuManager.cs:280)

Any idea how to figure out what's wrong and fix it? The SaveLoad.cs file just have a function that runs when I hit F1, which contains the documentation script listed above (near the top of this post). Thanks.

 
Posted : 18/05/2015 6:54 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Did you see if the webservice creates the file in the folder "upload"? It may be a permission issue, the upload folder (as well as _logs) must have write permission on the system (if you're running a *nix, then use: chmod -R 777 upload).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 18/05/2015 11:32 am
(@webbstre)
Posts: 21
Eminent Member
Topic starter
 

That fixed it! I can now see a nice little screenshot saved and uploaded to the server. Thank you!

I'd like to ask a little more about what kinds of files I can upload, and how. I see stuff in the code for JSON and Hash but I don't really understand any of it. Can I upload any kind of file type? I'm still trying to lock down how I want to do my level saves for my game. Can I have a basic explanation? I've looked at the code in the documentation but I only really half understand it.

 
Posted : 18/05/2015 3:42 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

You can upload any type of files and any size, as long as it's allowed by your web server settings (php.ini [google for post and upload allowed size], Web.config on IIS or httpd.conf on Apache/XAMPP). To upload a file you need to pass the bytes array to the method, as it does with the take screenshot example (if it's a file on the sytem storage you can use File.ReadAllBytes).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 18/05/2015 4:58 pm
Share: