File Upload AJAX
This commit is contained in:
parent
a7d79d60ab
commit
77ba8021bc
4 changed files with 36 additions and 10 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue