When I try to send a postman file to my Laravel API, the result always returns "NULL"
my controller looks like this:
public function store() { $file = Input::file('image'); var_dump($file); }
And my route file:
Route::post('test', ' TestController@store ');
But when I try to send the image to the postman, I get the result "NULL"
My postman config:
http://app.dev/test (POST)
Content-Type - multipart / form-data
Data form
image - test.jpg
Did I miss something?
I checked php.ini so that I have enough space to load
My problem is exactly the same as in this post: Correct postman settings when testing file uploads in Laravel 4?
But his solution did not work. I already checked my php.ini
The code below works if I use the resource controller and enter the URL from the browser:
public function store() { $input = Input::all(); $path = public_path() .'/images/123/'; $inpusqt = Input::file('images'); $i = 1; File::exists($path) or File::makeDirectory($path); foreach($inpusqt as $file) { $filExt = $file->getClientOriginalExtension(); $ext = '.' . $filExt; $lol = Image::make($file->getRealPath()); $lol->heighten(258)->save($path . $i . $ext); $i++;
But if I change my route, for example, to post: :( controller @store) and send the images to the postman, he will receive an error message: "Undefined index: images"
file api php mysql laravel
user2722667
source share