retrieved upload images in php

Posted by hunter on Stack Overflow See other posts from Stack Overflow or by hunter
Published on 2010-12-27T05:50:41Z Indexed on 2010/12/27 5:53 UTC
Read the original article Hit count: 171

Filed under:

i want to retrieve image from client (ipod) programmed in objective c i use the following code

$TARGET_PATH = "pics/";
$image = $_FILES['photo'];
$TARGET_PATH =$TARGET_PATH . basename( $_FILES['photo']['name']);
$TARGET_PATH =$TARGET_PATH.".jpg";
if(file_exists($TARGET_PATH))
    {
$TARGET_PATH =$TARGET_PATH .uniqid() . ".jpg";
}
if (move_uploaded_file($image['tmp_name'], $TARGET_PATH))
{
    $TARGET_PATH="http://www.".$_SERVER["SERVER_NAME"]."/abc/".$TARGET_PATH;
        echo $TARGET_PATH;
        echo "image upload successfully";}
else{
    echo "could not upload image";
}

this code upload five to six images successfully and after that it gives me error i.e

Notice:  Undefined index:  photo in /home/abc/public_html/abc.com/fish/mycatch_post.php on line 42
Notice: Undefined index: photo in /home/abc/public_html/abc.com/fish/mycatch_post.php on line 53
could not upload image

© Stack Overflow or respective owner

Related posts about php