开发者

Use file_put_contents as Upload Function?

开发者 https://www.devze.com 2022-12-17 11:17 出处:网络
Can i also us开发者_如何学Ce file_put_contents($fileapp,$content,FILE_BINARY); to move uploaded files?You can. But why not use move_uploaded_file() instead? This is generally considered to be safer th

Can i also us开发者_如何学Ce file_put_contents($fileapp,$content,FILE_BINARY); to move uploaded files?


You can. But why not use move_uploaded_file() instead? This is generally considered to be safer than trying to access the path in $_FILES, since move_uploaded_file() does check if the file really is a file and if it was actually uploaded by the user.

If you can't use the move_uploaded_file(), remember to call is_uploaded_file() before you do the file_put_contents() call. Just for your own safety.

0

精彩评论

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