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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:48:45+00:00 2026-06-01T22:48:45+00:00

I am having a very difficult getting this working and I have yet to

  • 0

I am having a very difficult getting this working and I have yet to come up with a working scenario. Basically, this is a simple user-friendly admin which is supposed to upload an image. However, I can’t get the upload to work. The filename is getting added to the database just fine but the image will not upload.

Here’s the code as is:

function editMain($data){
  array_pop($data);
  $where = "main_id = {$data['main_id']}";
  unset($data['main_id']);
//upload image
if ($_FILES['main_picture']['size'] > 1){ //if image deal with it
  $data['main_picture'] = '/images/'.$_FILES['main_picture']['name'];
  $uploadedfile = $_FILES['main_picture']['tmp_name'];
  if (move_uploaded_file($uploadedfile, SITE_ROOT.$data['main_picture']))
  echo "successfully uploaded {$data['main_picture']}<br />";
  else 
  echo "failed to upload {$data['main_picture']}<br />";
}

Thanks for looking and thanks in advance for pointing me in the right direction!

  • 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-01T22:48:46+00:00Added an answer on June 1, 2026 at 10:48 pm

    SITE_ROOT needs to be a local directory, ie “C:\...” or “/home/...“, it cannot be a URL structure. Change that to the local directory of where the file should be uploaded, check permissions, and you should be good to go.

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

Sidebar

Related Questions

I'm having a really difficult time getting eclipse to play nicely with this external
I am having difficulty geting a very simple view to display. This view has
I have been having a very difficult time editing my .htaccess file to do
I'm having a difficult time getting answers to a few very basic PHP questions.
So, I am having a very difficult time explaining my problem, I hope this
This is probably not a very difficult question to answer. I'm having trouble with
I'm trying to use this library (which looks very nice) but I'm having difficulty
Im having a very strange problem, i have a complicated view that returns incorrect
I've been having a very strange problem. I have a test class that subclasses
i'm having a very strange behaviour with this piece of code: <ui:fragment rendered=#{price.guestIdTrue}> <b>PRICE_GUEST_ID_TRUE

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.