Building fineuploader delete endpoint
Permalink
Hello everyone,
I am pretty new in concrete5 and now I am building a multiple image submission for general / registered user with fineuploader ( after I checked the image_file attribute is only allow single file submission ).
Now I am working on delete endpoint API for fineuploader, but I wonder how I can secure this endpoint. My code is as below.
Can anyone give some advice? Thank in advance =D
I am pretty new in concrete5 and now I am building a multiple image submission for general / registered user with fineuploader ( after I checked the image_file attribute is only allow single file submission ).
Now I am working on delete endpoint API for fineuploader, but I wonder how I can secure this endpoint. My code is as below.
public function deleteFile( $fID ) { $result = array( "success" => false , "error" => "error message to display" , "fileID" => $fID ); $file = \File::getByID( $fID ); if( is_object( $file ) ) { $file->delete(); $result['success'] = true; } else { $result['error'] = t('No such image.'); } echo json_encode($result); }
Can anyone give some advice? Thank in advance =D