开发者

Can I arbitrarily set $_FILE global

开发者 https://www.devze.com 2023-02-10 22:42 出处:网络
I have a function, not coded by me that uses the super global $_FILE[\'picture\'][开发者_JAVA百科\'temp_name\'] to create an image file and thumbnails. However, when a user does not upload an image, n

I have a function, not coded by me that uses the super global $_FILE['picture'][开发者_JAVA百科'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,


Yes you can, though it is generally not recommended (only as a hack to get around existing software limitations, like the ones you described).

0

精彩评论

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

关注公众号