This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-02-27 19:48:45 -04:00
parent 04d4cefa24
commit e17d8f4f0e
10 changed files with 282 additions and 54 deletions

View File

@@ -2,6 +2,7 @@
namespace Luracast\Restler\Format;
use Luracast\Restler\RestException;
use ProcessMaker\Validation\ValidationUploadedFiles;
/**
* Extending UploadFormat Support for Multi Part Form Data and File Uploads
@@ -84,8 +85,21 @@ class UploadFormat extends Format
throw new RestException(500, 'UploadFormat is read only');
}
/**
* Decode request.
*
* @param mixed $data
* @return array
* @throws RestException
*
* @see Luracast\Restler\CommentParser->parseEmbeddedData()
*/
public function decode($data)
{
$runRulesForFileEmpty = ValidationUploadedFiles::getValidationUploadedFiles()->runRulesForFileEmpty();
if ($runRulesForFileEmpty->fails()) {
throw new RestException($runRulesForFileEmpty->getStatus(), $runRulesForFileEmpty->getMessage());
}
$doMimeCheck = !empty(self::$allowedMimeTypes);
$doSizeCheck = self::$maximumFileSize ? TRUE : FALSE;
//validate