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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:18:13+00:00 2026-05-26T23:18:13+00:00

The php: //This is the directory where images will be saved $target = /images/;

  • 0

The php:

//This is the directory where images will be saved
$target = "/images/";
$target = $target . basename( $_FILES['photo']['name']);

//This gets all the other information from the form
$strListItemPic=(mysql_real_escape_string($_FILES['photo']['name']));

//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{

//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). " 
      has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}

The html:

    <input type="hidden" name="size" value="350000">
    <input type="file" name="photo">  

It’s breaking out and giving "Sorry, there was a problem uploading your file.";

I’m inserting $strListItemPic later in a MySQL statement, so I can echo the picture in a variable elsewhere.

Any glaring errors in this code? Does my $target have to be absolute paths?

PHP errors:

Warning: move_uploaded_file(/xxxxxx/lists/images/test.gif): 
failed to open stream: No such file or directory in 
/home/virtual/site48/fst/var/www/html/xxxxxx/lists/itemedit.php on line 22


Warning: move_uploaded_file(): Unable to move '/tmp/phpJ3v7HV' to 
'/xxxxxx/lists/images/test.gif' 
in /home/virtual/site48/fst/var/www/html/xxxxxx/lists/itemedit.php on line 22

Fixed:

Added enctype="multipart/form-data" to  <form>
Removed / before images in $target
  • 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-26T23:18:14+00:00Added an answer on May 26, 2026 at 11:18 pm

    Errors don’t have to glare in the code.
    Errors being raised at the time the code gets executed.
    And these errors have to be noted and investigated.

    at least add these 2 lines into your code and run it again.

    ini_set('display_errors',1);
    error_reporting(E_ALL);
    

    or get the error message produced by move_uploaded_file any other way.
    Trying to answer your question without an actual error message would be useless waste of time.

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

Sidebar

Related Questions

I have this PHP script which i'm grabbing images from a directory and displaying
So I have this script that will rotate images located in a directory, which
I've got a small php script that will gather all files in a directory.
I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php
This is simple, but I am taking an entire directory listing (in PHP with
I'm currently integrating a CMS (developed in PHP) authentication with Active Directory. This specific
WordPress allows theme designers to place a 404.php file in their theme's directory. This
In php this is how you would check if a file is selected: $_FILES['item']['size']>0
I am planning my directory structure for a linux/apache/php web project like this: Only
I have a directory of images, photos, web graphics, logos, etc... these are all

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.