开发者

Use PHP's file_get_contents with a file on users local system?

开发者 https://www.devze.com 2023-03-10 19:22 出处:网络
Is there a way to use PHP\'s file_get_contents() f开发者_高级运维unction on a file that a user is trying to upload from their computer through the browser with a form?Directly - no. This is not how PH

Is there a way to use PHP's file_get_contents() f开发者_高级运维unction on a file that a user is trying to upload from their computer through the browser with a form?


Directly - no. This is not how PHP works - it runs entirely on server side.

After uploading - definitely! You can load the file using the tmpfile element in the $_FILES array. See Handling File Uploads for more info.


Only way to communicate with the users filesystem is through the upload filesystem. There is of course a reason that you cannot just access files from a clients computer, this would imply enormous security issues.

If you really need to do something with files on a users computer, look into Adobe Flash, Silverlight, Java or write a plugin.

0

精彩评论

暂无评论...
验证码 换一张
取 消