I would really like to swap out my existing file upload structure for jquery-file-upload but I can’t seem to find any docs for using a database instead of a file system for storage.
Does anyone know if this is possible and if so where might I find some documentation or examples?
What platform are you using?
PHP? .NET? Ruby?
Without knowing the specifics let’s look at the JQuery PHP Example generically to see what is going on
You see in that file
Look at case ‘POST’
It contains the following
So if a file is Posted let’s look at the post routine [This is just meant to handle things in a RESTFul style it appears… proper verbs doing proper things, GET gets a file, Delete delete’s a file, POST Posts a file.]
So let’s look at those next relevant bits now
The ultimately important part for you here is
It is calling handle_file_upload. Now notice how all this works.
The file is uploaded and it determines what the verb was, get, post, delete. It doesn’t care if there is a database or not it only cares what do I do next. It figures to call post
Post then figures hey I need to call handle_file_upload. Now handle_file_upload is a black box to you in a sense, you can just replace it with another one that handles it using some database logic.
If you look at the function handle_file_upload you’ll see
private function handle_file_upload($uploaded_file, $name, $size, $type, $error) {
So take those parameters and use them to make a database query and persist your files that way. Basically just rewrite handle_file_upload
Anyway hope this helps.