function upload_tmp_image() { $upload_image = new \Library\Php\File\UploadImage(); if (isset($_POST['photo_width']) && $_POST['photo_width'] != null) { foreach ($_POST['photo_width'] as $key => $parameter) { $answer = $upload_image->upload('new_photo', $_POST['photo_width'][$key], $_POST['photo_height'][$key], TMP_IMAGE_DIR, $_POST['photo_method'][$key], $_POST['photo_forced'][$key], $_POST['photo_quality'][$key]); if ($answer == UPLOAD_ERR_OK) { $this->set_variable("name" . $key, $upload_image->fileName); } else { $this->set_error($answer); } } } $this->javascript_answer(); }
function check_field($prefix, $action) { global $parametersMod; if (isset($_POST[$prefix . '_delete']) && $this->required) { return $parametersMod->getValue('developer', 'std_mod', 'admin_translations', 'error_required'); } $this->new_mem_images = array(); foreach ($this->copies as $key => $copy) { $upload_image = new \Library\Php\File\UploadImage(); $error = $upload_image->upload($prefix, $copy['width'], $copy['height'], TMP_IMAGE_DIR, $copy['type'], $copy['forced'], $copy['quality']); if ($error == UPLOAD_ERR_OK) { $this->new_mem_images[$key] = $upload_image->fileName; } elseif ($error == UPLOAD_ERR_NO_FILE && $this->required && sizeof($this->mem_images) != sizeof($this->copies) && $action == 'insert') { return $parametersMod->getValue('developer', 'std_mod', 'admin_translations', 'error_required'); } elseif ($error == UPLOAD_ERR_NO_FILE) { return null; } elseif ($error == UPLOAD_ERR_EXTENSION) { return $parametersMod->getValue('developer', 'std_mod', 'admin_translations', 'error_file_type') . ' JPEG, GIF'; } else { return $parametersMod->getValue('developer', 'std_mod', 'admin_translations', 'error_file_upload') . " " . $error; } } if (sizeof($this->new_mem_images) > 0) { $this->mem_images = $this->new_mem_images; } elseif (isset($_POST[$prefix . '_delete'])) { $this->mem_images = array(); } return null; }