Error 405 method not allowed when uploading files

Hello, today i was adding an upload system to my site at ka-musicplayer-beta.glitch.me but i got a error 405 when i hit upload. I know this question is real short, but i have a full detailed question right here on stackoverflow: javascript - HTML Error 405 when uploading files to my servers - Stack Overflow
On that page i put where i got the code, the code itself, and also a runnable code snippet. I recommend you go there since it’s way more detailed.

Thank you,
alahmedkarim9

It looks like your site is made from the “Classic Website” starter, is that right?

That project sets you up with a static site where all you can do is HTTP GET, and POST is not allowed. Moreover, GET doesn’t cause PHP scripts to run; rather, it downloads the source code.

You’ll need to make some changes to have it actually run the PHP. That’s not officially supported on Glitch, because they’re focusing on Node.js apps. But let’s call over an expert @RiversideRocks to see if he has any ideas on how to do that.

3 Likes

Static sites don’t support requests other than GET and HEAD and can’t run server side code like PHP so you won’t be able to use a static site for what you want to do.

You could remix a project like ~hello-httpd and add your PHP code there or you could encourage users to upload files to a site like gofile.io.

2 Likes

Thanks! Could you guide me how to do it please?
What code do i have to change?

Thanks! How do i do it though?