How to get full filepath when uploading files in PHP?

后端 未结 3 1265
花落未央
花落未央 2021-02-10 00:47

I really want to know how am I gonna get the full filepath when I upload a file in PHP?

Here\'s my my problem...

I am importing a csv file in PHP. Uploading a fi

3条回答
  •  佛祖请我去吃肉
    2021-02-10 01:43

    you need to define a path into your config file or wherever you want to use and then that variable whatever you define, you can use in you project.

    i.e: define('FILE_UPLOADED_PATH','folder1/folder2/so on');
    

    so after the put this code your full filepath would be-

    FILE_UPLOADED_PATH.$_FILES['csv_file']['name'];
    

    you can use above code as example.

    Thanks.

提交回复
热议问题