diff --git a/vas/rest/class/vmlib/phpUtil.inc b/vas/rest/class/vmlib/phpUtil.inc index e87f2a4e541884be01cb0871e443de95e5a76749..14b020604ce25884e280cce338208e17f1e96c90 100755 --- a/vas/rest/class/vmlib/phpUtil.inc +++ b/vas/rest/class/vmlib/phpUtil.inc @@ -123,6 +123,7 @@ function uploadFile($sNomObjet, $sFileType, $sServerPath, $sMaxSize, $aFileValue if ($bAllowUpload) { if ($properties['fileS3Uploader']){ require_once ("aws_sdk/aws-autoloader.php"); + // Création du client S3 $s3 = new Aws\S3\S3Client(array( 'version'=>'latest', @@ -141,13 +142,13 @@ function uploadFile($sNomObjet, $sFileType, $sServerPath, $sMaxSize, $aFileValue } $sServerPath = str_replace($properties["vas_home"], $sPrefix , $sServerPath); + // envoi de l'objet sur S3 $aResult = $s3->putObject(array( 'Bucket' => $sBucket, 'Key' => $sServerPath, 'Body' => file_get_contents($sTmpFile) )); - } else if (!copy($sTmpFile, $sServerPath)) { writeToErrorLog(ERROR_COPYING_FILE . $aFileValues['name'] . ON_SERVER_PHPUTIL . ', ' . $sTmpFile . ', ' . $sServerPath); $sErrorMsg = ERROR_COPYING_FILE . $aFileValues['name'] . ON_SERVER_PHPUTIL . '.';