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

  • Home
  • SEARCH
  • 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 8279475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:21:31+00:00 2026-06-08T09:21:31+00:00

I have a small problem with my PHP image upload code, I`m not getting

  • 0

I have a small problem with my PHP image upload code, I`m not getting the correct file name to be saved to my MySQL database.

Please tell me what im doing wrong.

PHP:

// Upload File to Directory
$code = md5(time());
$image = $_FILES['userfile']['name'];
$imagename = $code.$image;
$uploaddir = '../_gallery/' . $imagename;
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);

MySQL query:

$sql="UPDATE b_events 
      SET ename = '$event_name', 
          edescription = '$event_description', 
          edate = '$event_date', 
          etime = '$event_time', 
          ecost = '$event_cost', 
          eimage = '$imagename' 
      WHERE id = '$update'";
$result=mysql_query($sql);
  • 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-08T09:21:32+00:00Added an answer on June 8, 2026 at 9:21 am

    you need to insert this name to your database becuase you upload file into directory by this name

    or by assigning values to new variable

    $sql="UPDATE b_events 
              SET ename = '$event_name', 
                  edescription = '$event_description', 
                  edate = '$event_date', 
                  etime = '$event_time', 
                  ecost = '$event_cost', 
                  eimage = '$uploadfile' 
            WHERE id = '$update'";
    

    OR

      $file_name =basename($_FILES['userfile']['name'];
    
    $sql="UPDATE b_events 
              SET ename = '$event_name', 
                  edescription = '$event_description', 
                  edate = '$event_date', 
                  etime = '$event_time', 
                  ecost = '$event_cost', 
                  eimage = '$file_name' 
            WHERE id = '$update'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small php script which allows me to upload image file on
I have a small problem, I want to load data from a PHP file
I have small problem with name spaces in php 5.3. I've made declaration for
I have a small problem with my PHP pagination, I have 6 records and
I have small problem. when i include file without ob_start, head's codes comes in
I have a small problem with php curl post. I am trying to post
I have an upload system based on SWFUpload which calls PHP script. The problem
I have a problem in getting the values from all the 3 IMAGE elements
I have a small programming problem (php & javascript). On index.php page I'm printing
I have following client code to upload image from phone $(#placeorder).click( function() { if

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.