Coronium - Having trouble uploading any files to the server

Hi,

I just installed Coronium and have been trying to set it up for the past day or two.

I stumbled upon an issue when trying to use a piece of the demo code to upload a file to the server.

Here’s the code I am trying to call ( I already init the Coronium connection beforehand )

local function uploadListener( evt )     if evt.error then       print( evt.error )     else       if evt.progress then          print( evt.progress )       else      print("file upload complete")          print("filePath: ", evt.result.path)          print("fileName: ", evt.result.file)       end     end  end core.files.upload( "Test-scenes/tutorial\_scene.json", system.ResourceDirectory, "tutorial\_scene.json", uploadListener )

What I get in the Corona Simulator is this:

19:01:45.513  progress: 0.51
19:01:45.513  0.51
19:01:45.609  error: Missing file headers
19:01:45.609  status: 804
19:01:45.609  tt: 257.2
19:01:45.609  Missing file headers

Any idea what that might mean? I am getting similar results with .png files and with .lua files

Any help will be greatly appreciated! 

Hi,

What version of Coronium Core are you currently running? You can find the version in the “System Info” section (in the Webmin) at the bottom.

-dev

This is what I see in the Webmin:

Coronium Core: v2.6.5-stable | Webmin: v2.0.0-beta

Thank you for the help beforehand :slight_smile:

P.S. Is there any other way to upload files to the server, for example from the webmin? That would be really useful I think.

Hi,

Yes, you can upload files using the Pages module, but you need to build the upload page. There is not a way currently in the Webmin, but I will put that on the request list.

Just sat down to look into your issue. I’ll report back shortly.

-dev

Hi,

Forgot to add the link https://develephant.github.io/coronium-core-docs/server/modules/pages/uploads/

-dev

Hi,

I don’t seem to be able to recreate the issue from the desktop, is this happening when running on a device?

-dev

It’s not on device, I’m using the Corona Simulator on Windows… I wonder whether the issue is because I upgraded the server to use HTTPS following the documentation or whether it’s something entirely different. I will try to use your exact demo project and change the server key there to check whether it will still throw this error.

Hi,

Have you tried uploading a file from the root of the project directory? I am wondering if it is a naming issue on Windows.

-dev

Just noticed that in the demo project you first copy a file from the root directory to the Documents Directory and then you upload it to the server from there. Is this the way to do it?

Okay, so now I tried with a single .png file in the root of the project and tried to upload it and it still says “Missing file headers”.

That’s strange…

Hi,

That is strange. What does your init look like (you can replace the ip and key with random whatever).

-dev

Generally you should upload from the Documents directory (hence the copy file in the demo). This is because of an Android issue that is explained in the Corona docs here https://docs.coronalabs.com/guide/data/readWriteFiles/index.html#android-file-restrictions

-dev

Hi,

I just sent you a link to a test project in your Forum mail. See if you get the same result.

-dev

Hi,

Well I am baffled that it is not working. A couple questions:

  • Where is the Coronium Core server hosted?
  • What version of Corona are you running?
  • What version of Windows are you running?
  • What is the output if you place print( core.VERSION ) after the init method?

-dev

  • The server is hosted in Digital Ocean
  • Corona version is 2017.3184
  • Windows 10
  • Core version -> 2.6.3

Hi,

I’ll boot up a Windows machine with the same versions and see if I can recreate the issue. It is possible that the plugin didn’t install properly, but it seems like the error is coming from the server-side.

-dev

Thanks, really appreciate your help!

If you need any more info from me or if you need me to test something let me know.  :slight_smile:

Hi,

Thanks for reporting this issue. I’ve pushed an update to the plugin and it should be resolved. Corona should automatically update to the latest Coronium Core plugin when you run your project (you may want to close and reopen Corona). You can check the version with print( core.VERSION ) it should read 2.6.5 now.

Please let me know if it works. My tests on Windows 10 seems to show that it does.

Thanks again.

-dev

Thanks for the help! It seems to be working now. :slight_smile:

Hi,

What version of Coronium Core are you currently running? You can find the version in the “System Info” section (in the Webmin) at the bottom.

-dev