Home >Backend Development >PHP Tutorial >javascript - Is there any function in php that can get the full path of a file based on the file name? Or how to get the full path of the file in js?
For example:
<code>根据:demo.txt 获取他的全路径:C:/Users/ilovemosh/Desktop/demo.txt </code>
For example:
<code>根据:demo.txt 获取他的全路径:C:/Users/ilovemosh/Desktop/demo.txt </code>
Your file must be in include_path. It is impossible for you to give you an absolute path just by giving a file name. . Not so awesome
Portal
dirname(__FILE__)
Get the absolute path of the file
The folder where the currently executing PHP file is located __DIR__
, and then determine the file path based on the relative relationship between demo.txt
and the currently executing PHP file
Generally, to obtain file information, you must first use a certain method (such as uploading) before you can obtain its file information
The plupload plug-in of js allows you to upload this file (but it does not necessarily have to be successfully uploaded to where, you just get the file object for calculation) and then obtain the information of this file. The upload in the yii framework of php is also Can get the full path information of the file