Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7020745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:21:30+00:00 2026-05-27T23:21:30+00:00

I would really like to swap out my existing file upload structure for jquery-file-upload

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:21:31+00:00Added an answer on May 27, 2026 at 11:21 pm

    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

    https://github.com/blueimp/jQuery-File-Upload/blob/master/php/index.php
    

    You see in that file

    $upload_handler = new UploadHandler();
    
    header('Pragma: no-cache');
    header('Cache-Control: private, no-cache');
    header('Content-Disposition: inline; filename="files.json"');
    header('X-Content-Type-Options: nosniff');
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
    header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
    
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'OPTIONS':
            break;
        case 'HEAD':
        case 'GET':
            $upload_handler->get();
            break;
        case 'POST':
            $upload_handler->post();
            break;
        case 'DELETE':
            $upload_handler->delete();
            break;
        default:
            header('HTTP/1.1 405 Method Not Allowed');
    }
    

    Look at case ‘POST’

    It contains the following

        $upload_handler->post();
    

    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

      public function post() {
            if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
                return $this->delete();
            }
            $upload = isset($_FILES[$this->options['param_name']]) ?
                $_FILES[$this->options['param_name']] : null;
            $info = array();
            if ($upload && is_array($upload['tmp_name'])) {
                foreach ($upload['tmp_name'] as $index => $value) {
                    $info[] = $this->handle_file_upload(
                        $upload['tmp_name'][$index],
                        isset($_SERVER['HTTP_X_FILE_NAME']) ?
                            $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
                        isset($_SERVER['HTTP_X_FILE_SIZE']) ?
                            $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
                        isset($_SERVER['HTTP_X_FILE_TYPE']) ?
                            $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
                        $upload['error'][$index]
                    );
                }
            } elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
                $info[] = $this->handle_file_upload(
                    isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
                    isset($_SERVER['HTTP_X_FILE_NAME']) ?
                        $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ?
                            isset($upload['name']) : null),
                    isset($_SERVER['HTTP_X_FILE_SIZE']) ?
                        $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ?
                            isset($upload['size']) : null),
                    isset($_SERVER['HTTP_X_FILE_TYPE']) ?
                        $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ?
                            isset($upload['type']) : null),
                    isset($upload['error']) ? $upload['error'] : null
                );
            }
    

    The ultimately important part for you here is

    $this->handle_file_upload(
                        $upload['tmp_name'][$index],
                        isset($_SERVER['HTTP_X_FILE_NAME']) ?
                            $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
                        isset($_SERVER['HTTP_X_FILE_SIZE']) ?
                            $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
                        isset($_SERVER['HTTP_X_FILE_TYPE']) ?
                            $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
                        $upload['error'][$index]
                    );
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would really like to deploy my project using jquery but afraid it may
I would really like to use SpringSource dm Server, but our customer requires us
This seems like a silly question but I would really like your comments and
This is a bit of an open question but I would really like to
This might be on the discussy side, but I would really like to hear
I would really like to use Silverlight for a project I'm working on but
I would really like use the jQuery Validation plugin in my ASP.NET Web Forms
I would really like to include this in my application if anyone has any
This may be a subjective question leading to deletion but I would really like
I would really like to check out the source code of some website. They

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.