Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHp-mvc-rest-api #1

Closed
syamasundararao opened this issue Sep 12, 2019 · 16 comments
Closed

PHp-mvc-rest-api #1

syamasundararao opened this issue Sep 12, 2019 · 16 comments
Assignees
Labels
bug Something isn't working

Comments

@syamasundararao
Copy link

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...

@afgprogrammer
Copy link
Owner

Ok, I will fix it until tomorrow.

@afgprogrammer afgprogrammer self-assigned this Sep 12, 2019
@afgprogrammer afgprogrammer added the bug Something isn't working label Sep 12, 2019
afgprogrammer added a commit that referenced this issue Sep 12, 2019
@syamasundararao
Copy link
Author

syamasundararao commented Sep 13, 2019 via email

@afgprogrammer
Copy link
Owner

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

@syamasundararao
Copy link
Author

syamasundararao commented Sep 13, 2019 via email

@afgprogrammer
Copy link
Owner

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.

@syamasundararao
Copy link
Author

syamasundararao commented Sep 13, 2019 via email

@afgprogrammer
Copy link
Owner

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

@syamasundararao
Copy link
Author

syamasundararao commented Sep 13, 2019 via email

@afgprogrammer
Copy link
Owner

afgprogrammer commented Sep 13, 2019

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.

@syamasundararao
Copy link
Author

syamasundararao commented Sep 13, 2019 via email

@afgprogrammer
Copy link
Owner

Sorry, your attachment does not show for me.

@syamasundararao
Copy link
Author

syamasundararao commented Sep 14, 2019 via email

@afgprogrammer
Copy link
Owner

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

@syamasundararao
Copy link
Author

syamasundararao commented Sep 16, 2019 via email

@syamasundararao
Copy link
Author

syamasundararao commented Sep 16, 2019 via email

@afgprogrammer
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants