Need help on File Upload functionality..in PHP

Discussion in 'PHP' started by gvlogic, Nov 12, 2009.

  1. #1
    Hi, My name is Gaurav, I am just the beginner in PHP .. i am coding a webpage which will upload a "word/open office" file ..But after several try i am unable to upload ...
    I am not clear with different variables needed....Kindly suggest what to do...the lines i have written are below..

    <?php
    $file_dir="/home/gv/Desktop/upload";

    echo"path: ".$_FILES["cvt"]."<br> \n";
    echo"name: ".$_FILES["cv"]."<br>";
    echo"type:".$_FILES["image/jpeg"]."<br>";
    echo"size:".$_FILE["10240"]."<br>";

    if(is_uploaded_file($_FILES["cvt"])){
    move_uploaded_file($_FILES["fileupload"]["cvt"],"$_file_dir".$FILES["fileupload"]["cv"])or die ("Coudn't copy");
    echo "file was moved";
    }
    ?>


    Please suggest what are the errors !!:confused:
     
    gvlogic, Nov 12, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    AsHinE, Nov 12, 2009 IP
  3. jackjamil

    jackjamil Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you also can try with copy() function like:

    copy($_FILES["tmp_name"],destination_file)
     
    jackjamil, Nov 12, 2009 IP