patch Missing parameter file for uploadImage

This commit is contained in:
Yoggzo 2016-05-08 21:20:15 +02:00
parent 4bac080418
commit e10ce91a63
2 changed files with 4 additions and 6 deletions

View file

@ -38,9 +38,8 @@
<input type="hidden" name="task" value="image" /> <input type="hidden" name="task" value="image" />
<input type="hidden" name="token" value="{{ getToken()}}" /> <input type="hidden" name="token" value="{{ getToken()}}" />
<input type="hidden" name="action" value="uploadImage" /> <input type="hidden" name="action" value="uploadImage" />
<input type="hidden" name="id" value="{{ image.id}}" /> <input type="hidden" name="id" value="{{ image.id}}" />
<input type="hidden" name="file_name" value="cirros-0.3.4-x86_64-disk.img" />
<fieldset class="form-group"> <fieldset class="form-group">
<label class="control-label col-sm-2">Upload</label> <label class="control-label col-sm-2">Upload</label>
<input name="file" type="file"/> <input name="file" type="file"/>

View file

@ -388,7 +388,6 @@ class image implements Core{
*/ */
private function uploadImage(){ private function uploadImage(){
$id = $this->app->getPostParam("id"); $id = $this->app->getPostParam("id");
$file = $this->app->getPostParam("file");
$file_name = $_FILES['file']['name']; $file_name = $_FILES['file']['name'];
$file_error = $_FILES['file']['error']; $file_error = $_FILES['file']['error'];
$file_tmp = $_FILES['file']['tmp_name']; $file_tmp = $_FILES['file']['tmp_name'];
@ -406,10 +405,10 @@ class image implements Core{
return; return;
} }
if( !is_uploaded_file($file_tmp) ) if( !is_uploaded_file($file_tmp) )
{ {
$this->app->setOutput("Error", "File Upload Error"); $this->app->setOutput("Error", "File Upload Error");
return; return;
} }
if(!isset($id)){ if(!isset($id)){
$this->app->setOutput("Error", "Incorrect id parameter"); $this->app->setOutput("Error", "Incorrect id parameter");