I have a plugin that creates a local JSON file and uploads it to S3 using
insertFileByLocalPath. The file is created, saved, and uploaded to s3 successfully. However, S3 detects the content-type to be
text/plain and not
application/json. Does anyone know of a way to force the content-type when creating an asset?
$jsonStr = json_encode($arrayToBecomeJson); $fileName = $myFileName . '.json'; $tempPath = AssetsHelper::getTempFilePath('json'); file_put_contents($tempPath, $jsonStr); $assetSaveSuccess = craft()->assets->insertFileByLocalPath( $tempPath, $fileName, $assetFolderId, AssetConflictResolution::Replace );