-
Notifications
You must be signed in to change notification settings - Fork 290
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
$request->files() is empty #373
Comments
Did you ever figure this out????? I have the same issue, i believe we need to handle the incoming files in the router page and not in the routed page and then build the request array and pass it along. i.e. if index.php includes inc/router.php and router.php has the routing code And the routing code takes the 'post' and routes it to a controller, then the router strips the incoming data. Which sucks and lacks examples completely. The apparant way to handle this is something like: **$klein->respond('POST', '/uploads/?', function($request, $response) use ($db, $errors){ ** I stole that code from an upload example here: https://github.com/Mobnia/php-resumeable-upload In this he does all the routing and processing within index.php which is not optimal for a scalable solution. I'd really like to know how to forward a POST request to a sub-php page and then handle the files from there. i.e. ** } So if someone calls /api/v1/upload they get serviced by /controllers/upload.php This works in terms of routing right now, but as you have able, the $request->files(); object is complete empty. |
For any people who may have found this thread by googling for "php klein files empty" or something similar (like I did), I figured out my mistakes and hopefully this can help you as well. First of all, when you call That is the intended behavior, and it actually makes things easier. The uploaded files are wrapped in the To accomplish what the OP seems to have wanted, simply call |
Hi,
Tried to processs image upload using $request->files(), but it seem not working.
when i try
var_dump($request->files());
here is what i got
The text was updated successfully, but these errors were encountered: