input type=file 上传文件      把文件上传到 服务器里的image下 应该怎么写 

解决方案 »

  1.   

    看看这里
    http://www.w3school.com.cn/php/php_file_upload.asp
      

  2.   

    给个简单的例子吧:
    <?php 
    if($_POST['submit']){
    move_uploaded_file($_FILES["file"]["tmp_name"],
          "./images/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "images/" . $_FILES["file"]["name"];}
    ?>
    <html>
    <body>
    <form action="" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file" /> 
    <input type="submit" name="submit" value="Submit" />
    </form>
    </body>
    </html>
      

  3.   

    加注释的代码:
    <?php 
    if($_POST['submit']){
    $url="./images/";//服务器的绝对路径目录
    move_uploaded_file($_FILES["file"]["tmp_name"],
          "$url" . $_FILES["file"]["name"]);//从临时目录把文件移入服务器指定目录
          echo "Stored in: " . "images/" . $_FILES["file"]["name"];}
    ?>
    <html>
    <body>
    <form action="" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file" /> 
    <input type="submit" name="submit" value="Submit" />
    </form>
    </body>
    </html>
      

  4.   


    move_uploaded_file  是否有重复的文件 不会覆盖。。