Changing the allowe...
Clear all

Changing the allowed extensions?

3 Posts
2 Users
Posts: 9
Active Member
Topic starter

I'm trying to allow users to upload different filetypes. When I try to upload different files like mp4 etc, the url gets switched to .dat. So far the only files I'm able to save are .png, and .txt. I can't find where in the server code the filename is getting modified.

UserFile file = new UserFile ();
file.sharing = eShareType.Everybody; // Added SDR
file.customData ["ScreenSize"] = Screen.width + "x" + Screen.height; = "test.mp4";
file.Update(data, (bool success, string error) => {
Debug.Log("Upload success: " + success + " -- error: " + error);

The url get saved to something like "c6912cd6a2d50562b11157777d8d587c.dat"

I see the function SetAllowedExtensions in FileUpload.php, but I don't see where this is being called? Is there an easy way I can change the allowed extensions?

Posted : 13/10/2021 2:49 pm
Posts: 793
Prominent Member Admin

The problem is that the filename isn't passed to the WWWForm field, so it's autogenerated by PHP on the fly while uploading is in progress. I will add in the next update the possibility to specify the filename and eventually mime-type directly in CombuForm.AddBinaryData that is used to upload the files.


Posted : 13/10/2021 3:43 pm
Posts: 9
Active Member
Topic starter

Thanks for that! I've been poking around in the server code to see if I  can figure it out myself, but I can't find where the ".dat" extension is being added? My thinking is that the file name is included in the WWWForm so I could just parse that to get the file extension. 

Posted : 16/10/2021 6:03 pm