www.webdeveloper.com
Results 1 to 2 of 2

Thread: error in image upolad "move_upload_file()"

  1. #1
    Join Date
    Mar 2013
    Posts
    6

    error in image upolad "move_upload_file()"

    im new developer

    i get below error

    when i upload the image


    Warning: move_uploaded_file(proimage/1.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in F:\xampp\htdocs\cleanred\uploadads.php on line 161

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'F:\xampp\tmp\php1CB1.tmp' to 'proimage/1.jpg' in F:\xampp\htdocs\cleanred\uploadads.php on line 161
    Stored in: proimage/1.jpg


    PHP Code:
    <?php
    // May 25, 2010
    $currentDate date("F j, Y");

        

    if(
    $_POST['title'] != ''  && $_POST['catergory'] != ''  && $_POST['des'] != ''  && $_POST['phone'] != ''  && $_POST['add'] != ''   && $_POST['city'] != '' && $_POST['file']!='' && $_POST['date']!='' )

        
        {
            
            
    $title $_POST['title'];
            
    $catergory $_POST['catergory'];
            
    $des $_POST['des'];
            
    $phone=$_POST['phone'];
            
    $add $_POST['add'];                                
            
    $city $_POST['city'];
            
    $file=$_POST['file'];
            
    $currentDate $_POST['date'];
           
             include(
    "include/connection.php");
            
        if (!
    $conn)    {
                    die(
    'Could not connect: ' mysql_error());
                }
                
                
    mysql_select_db($database $conn) or die (mysql_error());
                    
                        
    $query mysql_query("INSERT INTO upload ads (title,catergory, des, phone ,add,city,file,date) VALUES ('".$title."','".$catergory."','".$des."', '".$phone."'    ,'".$add."','".$city."','".$file."','".$currentDate."')");
                
            
                
            
            if(
    $query){
            echo 
    " Enter the code form your phone";
    }
    else {
    echo 
    "Contact number cant recieve the code";
    }

    mysql_close($conx);
        }




            


    if (((
    $_FILES["file"]["type"] == "image/gif")
    || (
    $_FILES["file"]["type"] == "image/jpeg")
    || (
    $_FILES["file"]["type"] == "image/pjpeg"))
    && (
    $_FILES["file"]["size"] < 50000000))
      {
      if (
    $_FILES["file"]["error"] > 0)
        {
        echo 
    "Return Code: " $_FILES["file"]["error"] . "<br />";
        }
      else
        {
        
    //echo "proimage: " . $_FILES["file"]["name"] . "<br />";
        //echo "Type: " . $_FILES["file"]["type"] . "<br />";
        //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

        
    if (file_exists("proimage/" $_FILES["file"]["name"]))
          {
          echo 
    $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
              
          
    move_uploaded_file($_FILES["file"]["tmp_name"],
          
    "proimage/" $_FILES["file"]["name"]);
          echo 
    "Stored in: " "proimage/" $_FILES["file"]["name"];
          }
        }
      }
    else
      {
      echo 
    "Invalid file";
      }
    ?>

  2. #2
    Join Date
    May 2004
    Location
    chennai, tamil nadu, India
    Posts
    445
    Try making

    'proimage/1.jpg'
    also as full path.
    Chris, Senior Developer,
    Php laravel developers,
    www.chrisranjana.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles