PHPackages                             azumag/graphql-upload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. azumag/graphql-upload

ActiveLibrary[File &amp; Storage](/categories/file-storage)

azumag/graphql-upload
=====================

A middleware to support file uploads in GraphQL

3.0.0(7y ago)031MITPHP

Since Jan 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/azumag/graphql-upload)[ Packagist](https://packagist.org/packages/azumag/graphql-upload)[ RSS](/packages/azumag-graphql-upload/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (0)

GraphQL Upload
==============

[](#graphql-upload)

[![Build Status](https://camo.githubusercontent.com/ec2861121e3619cee506fa45f6eb3ba9932ca7a9e68ae990e7c1eab766856512/68747470733a2f2f7472617669732d63692e6f72672f45636f6465762f6772617068716c2d75706c6f61642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Ecodev/graphql-upload)[![Code Quality](https://camo.githubusercontent.com/a8f05cc7962119fd9d4f3f67b8789301ed77f44d0817780e44b3b9749acc0935/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f45636f6465762f6772617068716c2d75706c6f61642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Ecodev/graphql-upload/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/7b3ac0e699caafe35065bbae141ac0832b427f1449023ad8eb4d00cf57d099ec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f45636f6465762f6772617068716c2d75706c6f61642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Ecodev/graphql-upload/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/bede706b070d442827228fc6ab27e139cf8badaa18a238375b8702ff8bce66dc/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/ecodev/graphql-upload)[![Latest Stable Version](https://camo.githubusercontent.com/fa68f85be79dffa509f263f9b06a60e74b3acc3347782d7cbf2e50860c487712/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f762f737461626c652e706e67)](https://packagist.org/packages/ecodev/graphql-upload)[![License](https://camo.githubusercontent.com/ec34e22eb182c733cbbe100730a05a4a6cd89c28e2b0f5513aad6ad6a1e01b58/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f6c6963656e73652e706e67)](https://packagist.org/packages/ecodev/graphql-upload)[![Join the chat at https://gitter.im/Ecodev/graphql-upload](https://camo.githubusercontent.com/e1cb5d424041ef4148f8707608fcd2a6ce99cfb56bf5129a39f8b3d46a91e180/68747470733a2f2f6261646765732e6769747465722e696d2f45636f6465762f6772617068716c2d75706c6f61642e737667)](https://gitter.im/Ecodev/graphql-upload)

A middleware to support file uploads in GraphQL. It implements [the multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec)for [webonyx/graphql-php](https://github.com/webonyx/graphql-php).

Quick start
-----------

[](#quick-start)

Install the library via composer:

```
composer require ecodev/graphql-upload
```

### Configure as middleware

[](#configure-as-middleware)

In Zend Expressive, it would typically be in `config/routes.php` something like:

```
use Application\Action\GraphQLAction;
use Zend\Expressive\Helper\BodyParams\BodyParamsMiddleware;
use GraphQL\Upload\UploadMiddleware;

$app->post('/graphql', [
    BodyParamsMiddleware::class,
    UploadMiddleware::class, // This is the magic
    GraphQLAction::class,
], 'graphql');
```

### Direct usage

[](#direct-usage)

Or if you don't use middleware, it can be called directly like so:

```
