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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:14:27+00:00 2026-06-01T04:14:27+00:00

Hi guys I keep getting an error no image selected when I try and

  • 0

Hi guys I keep getting an error no image selected when I try and upload, the upload form is definitely the right name and id same for the upload so it must be something wrong with the code, can anyone see why?

<?php


// Create MySQL login values and 
// set them to your login information.
$username = "**";
$password = "**";
$host = "**";
$database = "**";

// Make the connect to MySQL or die
// and display an error.
$link = mysql_connect($host, $username, $password);
 if (!$link) {
      die('Could not connect: ' . mysql_error());
   }

   // Select your database
    mysql_select_db ($database);  

     session_start();
     if(!isset($_SESSION['username']))
    {
          die('You have no access to this page.');
    }
  else{
  $username = $_SESSION['username'];
   // Make sure the user actually 
   // selected and uploaded a file
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 

  // Temporary file name stored on the server
  $tmpName  = $_FILES['image']['tmp_name'];  

  // Read the file 
  $fp      = fopen($tmpName, 'r');
  $data = fread($fp, filesize($tmpName));
  $data = addslashes($data);
  fclose($fp);


  // Create the query and insert
  // into our database.
  $query = "INSERT INTO Members WHERE username = '$username' ";
  $query .= "(image) VALUES ('$data')";
  $results = mysql_query($query, $link);

  // Print results
  print "Thank you, your file has been uploaded.";

 }
else {
 print "No image selected/uploaded";
 }
 }
  // Close our MySQL Link
  mysql_close($link);
  ?>  
  • 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-01T04:14:29+00:00Added an answer on June 1, 2026 at 4:14 am

    Probably your <form> tag lacks enctype parameter. It should look like this:

    <form action="index.php?action=upload" method="post" enctype="multipart/form-data">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys! I keep getting a syntax error (unexpected $end), and I've isolated it
Hi guys I'm trying to keep developing SMS popup under the name of SMS
I'm testing python subprocess and I keep getting this error: $ python subprocess-test.py Traceback
Following Hartl's RailTutorial for Rails(3.2). I keep getting this error message or oddly a
I keep getting a compilier error whenever I run this... I am quite sure
I keep getting an error when overriding my getview method. This is what I
I keep getting this error and i have been trying everything for about a
Hey guys how can I make an app keep playing an mp3 after pressed
I'm trying to update a email field in Mysql through php. i keep getting
Can you guys show me how to get this ERD in 5th normal form?

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.