jneilliii / OctoPrint-CustomBackground

10 stars 3 forks source link

"Upload failed" uploading image file to OctoPrint #29

Closed aderusha closed 5 years ago

aderusha commented 5 years ago

When I drag a PNG into OctoPrint to upload locally (meaning, select file in an Explorer window, drag to the left side of the OctoPrint web page in Chrome to "Upload Locally"), an error is shown with the text:

Could not upload the file. Make sure that it is a valid file with one of these extensions: .g, .gco, .gcode, .stl

https://i.imgur.com/LH9M3uN.png

jneilliii commented 5 years ago

Is the extension of the file literally all caps?

aderusha commented 5 years ago

The filename I attempted to upload is 800x600_Transparent_Background.png, as shown in the error dialog screenshot above. Just tried renaming to test.png, same result. The error is pretty clear about what it's expecting. Uploading STLs through the same mechanism works as it says.

jneilliii commented 5 years ago

That's odd. I'll have to go back and check but i'm pretty sure png files are supported once the plugin is installed.

aderusha commented 5 years ago

To add some more data - this is my second OctoPrint install, both on RPi. The first was installed a couple years ago, upgraded as new releases came out, and I've been running your plugin on that system for quite a while and it works as expected. That's with everything at current versions.

I just installed a new system, clean install of OctoPrint, installed some plugins (no plugins that don't exist on the working system), and upload of PNGs doesn't work.

jneilliii commented 5 years ago

So I just tried on my OctoPrint 1.3.10 running on OctoPi 0.15.1 and it's working fine for me. Are there any errors in your ocotprint.log file?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity in 14 days. It will be closed if no further activity occurs in 7 days.

aderusha commented 5 years ago

No errors are logged outside of the message shown in the dialog, which clearly indicates it's unhappy with image files being uploaded. I also have another OctoPrint server that was installed a few years ago and regularly upgraded which does not exhibit this behavior - it only appears on a fresh installation.

LazaroFilm commented 5 years ago

Have you tried with another image? It could be your image that is corrupt.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity in 14 days. It will be closed if no further activity occurs in 7 days.

aderusha commented 5 years ago

I've resolved this problem with the "UploadAnything" plugin available in the OctoPrint plugin manager. This plugin allows PNGs to the list of allowed filetypes and now everything works as expected.

@jneilliii I think this behavior is a new default. If you can, try a fresh raspbian + octoprint installation and you'll see this error. The 2 octoprint installations I had installed a year or more ago and have updated along the way don't have this restriction, but a new installation does. New users will need to utilize a plugin or some other means of disabling the restriction which prevents uploading PNGs before using CustomBackground.

jneilliii commented 5 years ago

Quick question, was the file that you were uploading have all caps PNG or were they lowercase? From the function here in the code png files are allowed. Maybe its the difference between machinecode versus model being returned, although that shouldn't make a difference. The UploadAnything plugin works the same way as seen here.