h4cc/multipart

A PHP library for parsing and generating RFC1341 Multipart.

dev-master / 1.0.x-dev 2014-09-07 15:00 UTC

This package is not auto-updated.

Last update: 2024-11-19 04:23:59 UTC


README

Build Status

A PHP library for parsing (and generating) RFC1341 Multipart.

Finally a Multipart parser library for PHP!

Usage

$content = '--------------------------eb2d2b296b73a011' . "\r\n"
    . 'Content-Disposition: form-data; name="foo"' . "\r\n"
    . 'Content-Type: text/plain' . "\r\n\r\n"
    . 'bar' . "\r\n"
    . 'buz' . "\r\n"
    . '--------------------------eb2d2b296b73a011--' . "\r\n";
$contentType = 'multipart/form-data; boundary=a3d8fcba372c456a';

$parserSelector = new ParserSelector();
$parser = $parserSelector->getParserForContentType($contentType);
$multipart = $parser->parse($content);

var_dump($multipart);

Current Status

I needed a multipart parser, so a wrote one. If anybody would like to write a Generator, do so :)