Hi,I got an error when trying to download a JPG file captured using my phone camera,the error in the console states that it is an unsupported media type,however,some other jpg file can be downloaded successfully,any idea what causes this?
UPDATE: just tried compressing the same image that failed to download using adobe photoshop,I reduced the file size to 1mb and this time the file gets downloaded! What’s going on here? Could this be an issue of too big file size or compressing jpg file using adobe causes some changes on the file itself?
UPDATE 2: apparently this error is caused by the file size,I opened the image file in photoshop and change the compression size back to high quality (around 5mb) and the error occurred again!
What’s the actual file you are trying to work with? Can you upload it or give more specific information about it? Also, when you speak of compression, are you referring to some specific compression algorithm or are you reducing the file resolution, etc.
Android devices have a hard limit regarding how large images they can handle. You can check your device’s limit by using:
Im using a jpg file captured from my phone camera, here is ny situation:
Im buulding an app for android to let user upload inages from their phone gallery, all done using coronium core, and this all works perfectly, not problem at all here.
I also build a windows application with corona to download the inages that the user uploaded to the server, here is where the problem arise
Small jpg file around 1mb can be downloaded successfully, both in the simulator (the file downloaded to the sandbox folder) and on the windows build itself (located in appdata folder)
What I mean by compression is actually saving the jpg file (overwriting the same jpg file) but choosing the lower quality option
Ah, so it was just about the downloading procedure? I misunderstood you then. Based on the title “JPG File Unsupported Media Type”, I thought that you had problems with creating an image.
Well, if the download process works for smaller images, I have no idea why it might fail for larger ones. From what I remember, Coronium has good event listeners, so just check its documentation and you’ll be able to print out the event results to see where it fails.
You didn’t mention if you try to do something with the image afterwards, so if you are and if you don’t receive any errors and the download itself succeeds, then have you made sure that you actually wait for the download to finish before trying to do something with the image?
Immediately after I pressed the download button, the unsupported media type error shows up in the console
I will try to see the error handler again and see what else can be found there
I run a photo printing business and trying to build this app to have customer upload their images from their phone without the need to come to my shop, really hope someone here could help me with this issue as this could make or break the app that I’m building
This might be not related, but the download progress prints a negative value (something like -0.59) when in coronium docs it is stated that this progress value should be between 0 and 1
Hi, could someone help me try to upload and download this file using the core upload and download function to check if it works? Im using digitalocean server, the upload function works fine, the download returns an unsupported media type error in the console.
Some additional information,I printed the error code using the print(evt.error) function and it returns error code 415 in the console
Ichecked google and found out about this error code:
The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.
The format problem might be due to the request’s indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.
I have had issues with JPGs captured on Android phones before when opening them with Photoshop. The Galaxy A3 was especially troublesome. I never figured out why, but I can tell you some phones probably write less-than-perfect JPGs.
Hi, What version of Coronium are you running? Does the file extension end in .jpg or .jpeg. (your example link is jpeg) have you tried other files with any success. Generally this has to do with compression issues, such as an embedded color profile from PS. But it could also be a hard limit in download size, which I think is adjustable in Coronium. The issue seems to ring a bell. S3 and Coronium are completely different backends. The XML issue is new and something to do with S3 change in XML being returned. Looking into it. -dev
Hi dev, glad that you re replying, hope you re getting better!
Im using coronium 2.6.5 currently, I managed to solve the download issue by using your amazon s3 plugin, for the xml issue I create my own error handler function with the unhandlederror listener to handle the error and stop the app from crashing, so far it works but would be glad if you could update the plugin to fix the error
Chris, did you ever get to the bottom of this issue? I’m running into the same thing, and can confirm from my testing the filesize is 99% likely the culprit. I was using the default camera settings on my mobile devices (> 10 megapixels) and while it would upload, I wasn’t able to download. Limiting the picture quality to ~5 megapixels, thus limiting the file size, allowed the file to be downloaded.
If there is a way to remove the file size limit, that would be amazing. Let us know!
This patch should resolve the issue. If it does not, let me know. Unless you’re working with larger than 1MB downloads, you should generally skip this patch because it will consume slightly more memory.
Patch is only for Coronium Core 2.6.5 (you’ve been warned).
Instructions:
Log in to your Coronium Core server as the coronium user. Copy and paste the following one-liner into the console:
What’s the actual file you are trying to work with? Can you upload it or give more specific information about it? Also, when you speak of compression, are you referring to some specific compression algorithm or are you reducing the file resolution, etc.
Android devices have a hard limit regarding how large images they can handle. You can check your device’s limit by using:
Im using a jpg file captured from my phone camera, here is ny situation:
Im buulding an app for android to let user upload inages from their phone gallery, all done using coronium core, and this all works perfectly, not problem at all here.
I also build a windows application with corona to download the inages that the user uploaded to the server, here is where the problem arise
Small jpg file around 1mb can be downloaded successfully, both in the simulator (the file downloaded to the sandbox folder) and on the windows build itself (located in appdata folder)
What I mean by compression is actually saving the jpg file (overwriting the same jpg file) but choosing the lower quality option
Ah, so it was just about the downloading procedure? I misunderstood you then. Based on the title “JPG File Unsupported Media Type”, I thought that you had problems with creating an image.
Well, if the download process works for smaller images, I have no idea why it might fail for larger ones. From what I remember, Coronium has good event listeners, so just check its documentation and you’ll be able to print out the event results to see where it fails.
You didn’t mention if you try to do something with the image afterwards, so if you are and if you don’t receive any errors and the download itself succeeds, then have you made sure that you actually wait for the download to finish before trying to do something with the image?