我可以任意设置$_FILE全局吗
我有一个函数,不是由我编写的,它使用超级全局 $_FILE['picture']['temp_name'] 来创建图像文件和缩略图。但是,当用户不上传图像时,不会创建图像或缩略图,并且使用这些图像进行显示的另一个应用程序会变得混乱。
因此,当用户没有上传图像时,我想任意将 $_FILE['picture']['temp_name'] 设置为服务器中存储的图像,并传递 $_FILE['picture']['temp_name' ] 到我首先提到的功能。
我的问题是,我可以任意设置超级全局 $_FILE['picture']['temp_name'] = file_path/preset_image.jpg 吗?
谢谢你,
I have a function, not coded by me that uses the super global $_FILE['picture']['temp_name'] to create an image file and thumbnails. However, when a user does not upload an image, no image nor thumbnails get created, and another application that uses these images for display gets messed up.
So, when a user does not upload an image, I would like to arbitrarily set $_FILE['picture']['temp_name'] to an image stored in the server, and passed $_FILE['picture']['temp_name'] to the function I first mentioned.
My question is, can I arbitrarily set the super global $_FILE['picture']['temp_name'] = file_path/preset_image.jpg ?
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以,尽管通常不建议这样做(仅作为解决现有软件限制的方法,如您所描述的那样)。
Yes you can, though it is generally not recommended (only as a hack to get around existing software limitations, like the ones you described).