Gargron / fileupload

PHP FileUpload library that supports chunked uploads
MIT License
460 stars 87 forks source link

insert into database #12

Closed kamov closed 10 years ago

kamov commented 10 years ago

hi great libs! thanks! I have use jquery file upload with UploadHanlder.php default file, adding file into database when a file is uploaded. I guess how to do the same with this class: insert file into mysql table after upload, and delete from a mysql table when a file is deleted.

callback will be ideal, but seem not yet implmented or yes?

thanks

Gargron commented 10 years ago

There is a callback on when a file finished uploading:

$fileupload->addCallback('completed', function(FileUpload\File $file) {
  // Save to database here
});

However this library does not handle delete requests. Since delete requests are simple HTTP requests and have nothing to do with file uploading per se, you can just have your own route for them and handle the DB stuff there.

Cheers,
Eugen