src/repositories/UploadRepository.php
public function upload($input)
    {
        $validator = \Validator::make($input, config('dropzoner.validator'), config('dropzoner.validator-messages'));

        if ($validator->fails()) {

            return response()->json([
                'error' => true,
                'message' => $validator->messages()->first(),
                'code' => 400
            ], 400);
        }

        $photo = $input['file'];

        $original_name = $photo->getClientOriginalName();
        $extension = $photo->getClientOriginalExtension();
        $original_name_without_extension = substr($original_name, 0, strlen($original_name) - strlen($extension) - 1);

        $filename = $this->sanitize($original_name_without_extension);
        $allowed_filename = $this->createUniqueFilename( $filename );

        $filename_with_extension = $allowed_filename .'.' . $extension;

        $manager = new ImageManager();
        $image = $manager->make( $photo )->save(config('dropzoner.upload-path') . $filename_with_extension );

        if( !$image ) {

            return response()->json([
                'error' => true,
                'message' => 'Server error while uploading',
                'code' => 500
            ], 500);

        }

        //Fire ImageWasUploaded Event
        event(new ImageWasUploaded($original_name, $filename_with_extension));

        return response()->json([
            'error' => false,
            'code'  => 200,
            'filename' => $filename_with_extension
        ], 200);
    }
public function upload($input)
    {
        $validator = \Validator::make($input, config('dropzoner.validator'), config('dropzoner.validator-messages'));

        if ($validator->fails()) {

            return response()->json([
                'error' => true,
                'message' => $validator->messages()->first(),
                'code' => 400
            ], 400);
        }

        $photo = $input['file'];

        $original_name = $photo->getClientOriginalName();
        $extension = $photo->getClientOriginalExtension();
        $original_name_without_extension = substr($original_name, 0, strlen($original_name) - strlen($extension) - 1);

        $filename = $this->sanitize($original_name_without_extension);
        $allowed_filename = $this->createUniqueFilename( $filename );

        $filename_with_extension = $allowed_filename .'.' . $extension;

        $manager = new ImageManager();
        $image = $manager->make( $photo )->save(config('dropzoner.upload-path') . $filename_with_extension );

        if( !$image ) {

            return response()->json([
                'error' => true,
                'message' => 'Server error while uploading',
                'code' => 500
            ], 500);

        }

        //Fire ImageWasUploaded Event
        event(new ImageWasUploaded($original_name, $filename_with_extension));

        return response()->json([
            'error' => false,
            'code'  => 200,
            'filename' => $filename_with_extension
        ], 200);
    }
Upload Single Image

@param $input
@return mixed