File Upload AJAX

This commit is contained in:
Eole 2016-05-09 22:39:49 +02:00
parent a7d79d60ab
commit 77ba8021bc
4 changed files with 36 additions and 10 deletions

View file

@ -377,7 +377,7 @@ class image implements Core{
}
}
}
/**
* Upload an image
*
@ -388,9 +388,9 @@ class image implements Core{
*/
private function uploadImage(){
$id = $this->app->getPostParam("id");
$file_name = $_FILES['file']['name'];
$file_error = $_FILES['file']['error'];
$file_tmp = $_FILES['file']['tmp_name'];
$file_name = $_FILES['files']['name'];
$file_error = $_FILES['files']['error'];
$file_tmp = $_FILES['files']['tmp_name'];
switch($file_error){
case UPLOAD_ERR_INI_SIZE:
@ -405,10 +405,15 @@ class image implements Core{
return;
}
if( !is_uploaded_file($file_tmp) )
{
$this->app->setOutput("Error", "File Upload Error");
return;
}
{
//$this->app->setOutput("Error", "File Upload Error");
file_put_contents(
$file_tmp,
fopen("php://input", 'r'),
FILE_APPEND
);
}
if(!isset($id)){
$this->app->setOutput("Error", "Incorrect id parameter");