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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:08:26+00:00 2026-06-08T04:08:26+00:00

Trying since some days to clear my Error with uploading an Image to a

  • 0

Trying since some days to clear my Error with uploading an Image to a Folder and link to MySQL. I posted already my Problem but changed some codes thats why i want to post it again. Sorry if i spam.

This is my Code “adresse-bearbeiten.php”

<?php 
require_once ('konfiguration.php');
$target = "images/";
$target = $target . basename( $_FILES['photo']['name']);

    function sanitize( $input ){
    return mysql_real_escape_string( htmlspecialchars( stripslashes( trim( $input ) ) ) ); 
    }

    if(isset($_POST['title']))
        {

            $title          = sanitize($_POST['title']);
            $description    = sanitize($_POST['description']);
            $applepart      = sanitize($_POST['applepart']);
            $partnumber     = sanitize($_POST['partnumber']);
            $productcode    = sanitize($_POST['productcode']);
            $compatibility  = sanitize($_POST['compatibility']);
            $image          = sanitize($_FILES['photo']['name']);
            $price          = sanitize($_POST['price']);
            $insert         = mysql_query("INSERT INTO `adressbuch` (`title`,`description`,`applepart`,`partnumber`,`productcode`,`compatibility`,`photo`,`price`) VALUES ('$title','$description','$applepart','$partnumber','$productcode','$compatibility','$image','$price')");


            if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
            {

            echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
            }
            else {

            echo "Sorry, there was a problem uploading your file.";
            }

            if (!$insert)
            {
              die('Not saved: ' . mysql_error());
        }
    }
?>

        <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
          <span>Neuer Eintrag:</span> <br />
          <span>Title</span><input type="text" name="title" /> <br />
          <span>Description</span><textarea cols="16" rows="5"  name="description"></textarea> <br />
          <span>Apple Part</span><input type="text" name="applepart" /> <br />
          <span>Part Number</span><input type="text" name="partnumber" /> <br />
          <span>Product Code</span><input type="text" name="productcode" /> <br />
          <span>Compatibility</span><input type="text" name="compatibility" /> <br />
          <span>Image</span><input type="file" name="photo" /> <br />
          <span>Price</span><input type="text" name="price" /> <br />
          <input type="submit" value="Speichern"/> <br />
        </form>

The MySQL

CREATE TABLE IF NOT EXISTS `adressbuch` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `title` text,
  `description` text,
  `applepart` text,
  `partnumber` text,
  `productcode` text,
  `compatibility` text,
  `photo` text,
  `price` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;

The Errors i get is listed below

  • Notice: Undefined index: photo in
    /Users/fatih/Sites/phpform/neu/adresse-bearbeiten.php on line 11
  • Notice: Undefined index: photo in
    /Users/fatih/Sites/phpform/neu/adresse-bearbeiten.php on line 18
  • Notice: Undefined index: photo in
    /Users/fatih/Sites/phpform/neu/adresse-bearbeiten.php on line 23
  • Sorry, there was a problem uploading your file.

Would be happy if someone can tell me what am i doing wrong?
Regards

  • 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-08T04:08:28+00:00Added an answer on June 8, 2026 at 4:08 am

    I would check the following things:

    1. Is your form’s enctype set to multipart/form-data? It should be. (<form enctype="multipart/form-data">)

    2. What happens when you do an echo '<pre>';print_r($_FILES);exit; somewhere in your code? Does it output some info about your uploaded files? It should.

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

Sidebar

Related Questions

since I'm trying to solve this problem for some days, I thought about giving
I am new to C# .NET. I have been trying since 2 days, but
I am trying to solve a little problem since yesterday, but no solution found
I'm trying to speed up SELECT queries in MySQL tables which already have some
I have been trying since some days now to find a concrete answer for
This is the problem am facing since many days. am trying to manage that
I am trying to avoid using Net::SSH::Perl library since there is some problems in
I am trying since two days to install OpenCV 2.3.0 or 2.3.1 on my
I have been trying since yesterday to get google like paging, but each time
I am trying to have some clever dates since a post has been made

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.