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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:43:08+00:00 2026-05-26T18:43:08+00:00

I tried uploading a picture to a directory in my server with the code

  • 0

I tried uploading a picture to a directory in my server with the code below. However, when i run it, I get this error:

Warning: move_uploaded_file(images/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/a2943534/public_html/add.php on line 24

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/php7yEkDe’ to ‘images/’ in /home/a2943534/public_html/add.php on line 24

What am I missing here, please?

<?php
include_once("connect.php");
?> 
<?php 

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

 //This gets all the other information from the form 
 $title=$_POST['title'];
 $name=$_POST['name']; 
 $describe=$_POST['describe']; 
 $pic=($_FILES['photo']['title']);
 $url=$_POST['url'];
 $country=$_POST['country'];
 $endDate=$_POST['endDate']; 


 //Writes the information to the database 
 mysql_query("INSERT INTO `authors` VALUES ('$title', '$name', '$describe', '$pic', '$url', '$country', '$endDate')") ; 

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

 //Tells you if its all ok 
  $result =  "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 
 $result =  "Sorry, there was a problem uploading your file."; 
 } 
 ?> 
<?php
// if the form has been submitted, display result
if (isset($result)) {
  echo "<p><strong>$result</strong></p>";
  }
?>
  • 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-26T18:43:08+00:00Added an answer on May 26, 2026 at 6:43 pm

    rather than writing

    $target = $target . basename( $_FILES['photo']['title']);
    

    you should write

    $target = $target . basename( $_FILES['photo']['name']); 
    

    i think there is nothing like $_FILES[‘photo’][‘title’]..

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

Sidebar

Related Questions

I have tried uploading a transparent PNG image to a SQL server image field,
I tried to use this very simple script for uploading a file to my
I tried uploading files to my server my.php (normal local file) <?php $box_title= SEARCH
I tried to make multiple files uploading, and did this: rails plugin install git://github.com/kpitn/swfupload.git
I tried uploading an audio file from android client to server but I'm getting
Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of
Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
Tried a bunch of things but I can't get it to work consistently amid
I have tried uploading a photo to one of my forms on Internet Explorer
I'm uploading a file to the server. The file upload HTML form has 2

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.