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 8863161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:54:28+00:00 2026-06-14T15:54:28+00:00

I have been searching the net for some weeks now and can’t find a

  • 0

I have been searching the net for some weeks now and can’t find a solution to my issue.

I’m working on a Web application using Flex(front-end) and PHP/MySql(Back-end).

Now I want to enable users to upload images for their profile Pictures… I was Uploading them to a Directory on the server. Now my Boss “feels” that they should be stored directly to the Database not only store the link of the Image but the whole content.

Please Help guys….I’m stuck!!!

  • 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-06-14T15:54:30+00:00Added an answer on June 14, 2026 at 3:54 pm

    First of all in the form which you’re uploading the file from, you should use the following the tag:

    enctype="multipart/form-data" 
    

    also you need to specify that field as one of the following:

    TINYBLOB
    , BLOB
    , MEDIUMBLOB
    , LONGBLOB

    Finaly modify this code for your db and that will do 🙂

    <?php
    if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
    {
       $fileName = $_FILES['userfile']['name'];
       $tmpName  = $_FILES['userfile']['tmp_name'];
       $fileSize = $_FILES['userfile']['size'];
       $fileType = $_FILES['userfile']['type'];
    
       $fp      = fopen($tmpName, 'r');
       $content = fread($fp, filesize($tmpName));
       $content = addslashes($content);
       fclose($fp);
    
    if(!get_magic_quotes_gpc())
    {
        $fileName = addslashes($fileName);
    }
    
    $query = "INSERT INTO upload (name, size, type, content ) ".
    "VALUES ('$fileName', '$fileSize', '$fileType', '$content')";
    
    mysql_query($query) or die('Error, query failed'); 
    
    } 
    

    ?>

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

Sidebar

Related Questions

I have been searching some .css layouts for asp.net mvc model. I like the
I've been searching on Google for some C# programs. I have found Paint.NET. Is
I've been searching the net for answers but I can't seem to find a
I have been searching for a solution to this and so far found nothing
I have been searching for quite a bit now but I have never been
I have been searching for an answer and trying out stuff for days now
I have been searching for a few hours and cant seem to find answer
I have been searching for an hour on how to use FFmpeg from .NET
I have been searching quite a while now for how to read a nested
I have been searching for several hours now and have so far had no

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.