I think you have problem in middleware routes so follow this article
Check this article and follow steps for simple file uploading in php with ajax https://www.cloudways.com/blog/the-basics-of-file-upload-in-php/
if you have access to the command line, this would be easier
importing large text files using php probably uses too much memory
I think this article help you to build responsive shopping cart using php mysql with jquery.
Let's follow simple steps https://www.sourcecodester.com/php/12298/inline-shopping-cart-system-php-mysql.html