afgprogrammer/PHP-MVC-REST-API

PHp-mvc-rest-api

syamasundararao opened this issue · 16 comments

I liked your project a lot.. But I got some problem while accessing an URL which contains parameters with spaces like /fetch-name/syam Sundararao .
If I gave this I got route not found...
Please suggest me.. I studied your dispatch code. But unable to fix it...

Ok, I will fix it until tomorrow.

Your welcome, I think it does not need to change the regular expression.
I just convert the space to -

It's simple but you should know how an upload file does it works in PHP.
https://www.tutorialspoint.com/php/php_file_uploading.htm

There is an example in the link above and I have also a global file variable, you can access it with
$this->request->files('file-request-name'); in place of $_FILES[] in the Controllers file.

You can write it down and if you have any problem let me know.

I make it for you, you can check it out.

send a post request to '/upload' with an image file.

I attached an image from the postman request.

Screen Shot 2019-09-13 at 1 49 34 PM

It's so easy bro.
You can get all inputs with
$this->request->post('variable_name_you_send_from_ui');
$this->request->input('variable_name_you_send_from_ui'); // This is another way for post request
or
$this->request->get('variable_name_you_send_from_ui');
or
$this->request->files['variable_name_you_send_from_ui'];

And if I make everything for you, you can't learn anything, so trying a little more.

Sorry, your attachment does not show for me.

Use like this: $this->request->post('variable')
not that becuse the "post" is a function not an array.

For more information please look at the Request.php

Sorry, I did not use with authentication, but if you have some error or issue, send them to me I see them and fix it or implement to this project.