upload file with php and save path to sql

前端 未结 2 1677
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 03:37

Does anyone know any good tutorial on how to upload a file with php and save the files path to a sql server?

2条回答
  •  情话喂你
    2020-12-06 04:05

    From http://www.w3schools.com/php/php_file_upload.asp

    HTML

    
    
    
    

    PHP

     0)
        {
        echo "Return Code: " . $_FILES["file"]["error"] . "
    "; } else { if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; //<- This is it } } ?>

    Note that to upload the file you need to specify the path to save the file. If you save the file you already know it path.

提交回复
热议问题