Fix file upload feedback

This commit is contained in:
2019-06-28 00:06:23 +02:00
parent 4d46662544
commit 6d7f561544
3 changed files with 15 additions and 10 deletions

View File

@@ -327,9 +327,9 @@ class Spot extends Main
public function upload()
{
$this->oClassManagement->incClass('uploader', true);
new Uploader($this->oPicture);
$oUploader = new Uploader($this->oPicture);
return self::getJsonResult(true, '');
return $oUploader->sBody;
}
public function getAdminSettings() {

View File

@@ -7,11 +7,14 @@ class Uploader extends UploadHandler
* @var Picture
*/
private $oPicture;
public $sBody;
function __construct(&$oPicture)
{
$this->error_messages['wrong_project_mode'] = 'Le projet n\'est pas en mode "blog".';
$this->oPicture = &$oPicture;
$this->sBody = '';
parent::__construct(array('image_versions'=>array(), 'accept_file_types'=>'/\.(gif|jpe?g|png)$/i'));
}
@@ -29,6 +32,7 @@ class Uploader extends UploadHandler
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) {
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
if(empty($file->error)) {
$sError = $this->oPicture->addPic($file->name);
if($sError!='') {
@@ -38,6 +42,10 @@ class Uploader extends UploadHandler
return $file;
}
protected function body($sBodyPart) {
$this->sBody .= $sBodyPart;
}
}
/*