mansoorkhan's avatar

Large Excel File uploading Error: "The GET method is not supported for this route. Supported methods: POST"

Error: "The GET method is not supported for this route. Supported methods: POST". I have a form where I upload an Excel file (Size: 10MB, Rows: 10M+, Sheets: 8). After the upload is done I am using PHPSpreadSheet Library to read the data from the Excel file (sheet wise) and put it into different tables based on sheet name. This works completely fine on the localhost but when I test it on my server, I get the above error. I separated the upload/save logic and reading Excel file logic in separate controller methods/functions and then the above error was gone and new error came out i.e:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Can anybody help me with this issue?

Note: I tried to delete all the rows and saved the file with only 10 rows in each sheet. It executed everything perfectly.

PasteBin: https://pastebin.com/n45GrW4g

0 likes
7 replies
mansoorkhan's avatar

Yes, I also tried increasing that with:

ini_set('upload_max_filesize', '-1'); ini_set('post_max_size', '-1');

and with:

ini_set('upload_max_filesize', '256M'); ini_set('post_max_size', '256M');

But did not work.

as I am using shared hosting, changing the php.ini file is a problem. They might not do it for a single user. Should I do it in php.ini? is there any other way?

Snapey's avatar

You need to discuss it with your hosting provider.

one thing you can do is write a page that just dumps the current settings so you know if you have effected any change

1 like
mansoorkhan's avatar

Yes it changes to what I specify and I have also verified that using phpinfo()

mansoorkhan's avatar

I have also changed it from Cpanel: upload_max_filesize = 256M post_max_size = 512M

Still the same error.

mansoorkhan's avatar
mansoorkhan
OP
Best Answer
Level 3

Fixed/Solved. I tried two Packages : Laravel Excel and PHPSpreadSheet

These both were consuming a lot of memory and the server was not able to handle such a request, so I had to build something on my own and it's super fast and consumes low memory.

Please or to participate in this conversation.