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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:11:21+00:00 2026-05-28T14:11:21+00:00

Salutations, I am having problems allowing user’s(admin) the ability to upload files/images to the

  • 0

Salutations, I am having problems allowing user’s(admin) the ability to upload files/images to the server. Any help will be much appreciated.

Here is the part of my code where I am processing the file:

if ((($_FILES["image"]["type"] == "image/gif")
    || ($_FILES["image"]["type"] == "image/jpeg")
    || ($_FILES["image"]["type"] == "image/jpg")
    || ($_FILES["image"]["type"] == "image/pjpeg"))
    && ($_FILES["image"]["size"] < 20000))
    {
        if($_FILES['image']['error'] > 0)
        {
            header('Location: addAd.php?message='.$_FILES['image']['error'].'!');
        }
        else
        {
            if(file_exists('images/'.$_FILES['image']['name']))
            {
                header('Location: addAd.php?message=file already exists!');
            }
            else
            {
                move_uploaded_file($_FILES['image']['temp_name'],'images/'.$_FILES['image']['name']);
                $fileName = $_FILES['image']['name'];
            }
        }
    }
    else
    {
        header('Location: addAd.php?message=Invalid file!');
    }

And here is where I create the form:

echo '<form method="POST" action="" enctype="multipart/form-data">';
    for($i=1; $i<mysql_num_fields($rs); $i++)
    {
        $rsmd = mysql_fetch_field($rs,$i);
        if($rsmd->name == 'description')
        {
            echo '<textarea name="'.$rsmd->name.'" cols="40" rows="10"></textarea><br />';
        }
        else if($rsmd->name == 'image')
        {
            echo $rsmd->name.'<input type="file" name="'.$rsmd->name.'" /><br />';
        }
        else
        {
            echo $rsmd->name.'<input type="text" name="'.$rsmd->name.'" /><br />';
        }
    }
    echo '<input type="submit" value="submit" name="submit">';
    echo '</form>';
  • 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-28T14:11:22+00:00Added an answer on May 28, 2026 at 2:11 pm

    $_FILES['image']['temp_name'] should be: $_FILES['image']['tmp_name'] :

    move_uploaded_file($_FILES['image']['tmp_name'],'images/'.$_FILES['image']['name']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for something will accept names, salutations, and numbers. Things like Mr., O'Henry,
Greeting and Salutations! I work in an environment where I have a development server,
Greetings and salutations, I have two Android apps: one is the server and one
File1: hello - dictionary definitions: hi hello hallo greetings salutations no more hello for
I have pattern like below hi hello hallo greetings salutations no more hello for
I have made the following script to upload a csv and import it into
I am using jsonp and ajax to access a web service on another server.
Sorry about the strange title, but I am having a small issue if the
Salutations, Elders of code, I am on a quest to master the spells of
I'm trying to sync data from a CRM server back to a separate service,

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.