* [refac bug #65215] Check upload file for import.
This commit is contained in:
@@ -430,11 +430,13 @@ class caselib extends control
|
||||
{
|
||||
$this->loadModel('testcase');
|
||||
|
||||
if($_FILES)
|
||||
if($_POST)
|
||||
{
|
||||
$file = $this->loadModel('file')->getUpload('file');
|
||||
$file = $file[0];
|
||||
if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty));
|
||||
|
||||
$file = $file[0];
|
||||
if(!$file || (isset($file['extension']) && $file['extension'] != 'csv')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
|
||||
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
|
||||
|
||||
@@ -1236,14 +1236,16 @@ class testcase extends control
|
||||
{
|
||||
$this->testcaseZen->checkProducts(); // 如果不存在产品,则跳转到产品创建页面。
|
||||
|
||||
if($_FILES)
|
||||
if($_POST)
|
||||
{
|
||||
/* 获取上传的文件。 */
|
||||
/* Get file. */
|
||||
$file = $this->loadModel('file')->getUpload('file');
|
||||
if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty));
|
||||
|
||||
$file = $file[0];
|
||||
if(!$file || (isset($file['extension']) && $file['extension'] != 'csv')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
|
||||
/* 移动上传的文件。 */
|
||||
/* Move file. */
|
||||
@@ -1957,9 +1959,14 @@ class testcase extends control
|
||||
*/
|
||||
public function importXmind(int $productID, string $branch)
|
||||
{
|
||||
if($_FILES)
|
||||
if($_POST)
|
||||
{
|
||||
if($_FILES['file']['size'][0] == 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty));
|
||||
$file = $this->loadModel('file')->getUpload('file');
|
||||
if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty));
|
||||
|
||||
$file = $file[0];
|
||||
if(!$file || (isset($file['extension']) && $file['extension'] != 'xmind')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat));
|
||||
|
||||
/* 保存xmind配置。*/
|
||||
/* Sav xmind config. */
|
||||
|
||||
Reference in New Issue
Block a user