upload a file to a MySql DB with PHP

前端 未结 3 1208
深忆病人
深忆病人 2021-01-16 18:14

I want the users to upload files through my webapp I am developing in PHP usinig MySql in the backend. I want to store the files in the database. I am facing problems in doi

3条回答
  •  难免孤独
    2021-01-16 18:52

    it's in the tmp directory, till you move it

    $userfile = $_FILES['binFil']['tmp_name'];
    move_uploaded_file($userfile , "somedir");
    

    Afterwords you should detect what type it is with something like

    $userfileExt = array_pop(explode(':', $userfile));
    

提交回复
热议问题