简体   繁体   中英

How don't direct use $_FILES Superglobal in PHP?

I'm looking for an alternative to get the data inside the $_FILES due to a codacy issue

在此处输入图像描述

I don't know how to don't use directly the superglobals.

I can't use filter_input like I did for resolve the same issue with $_POST

Below this, my form:

<form class="d-flex flex-column" method="post" action="/image/update/99/trick/144" enctype="multipart/form-data">
    <input type="file" name="newImg">
    <button type="submit">Modifier l'image</button>
</form>

If the superglobals are completly forbidden for you, just work with the tmp file.

You can just read its content and write it somewhere else. But check everything first for security purpose: the extension, the size, and here (because it's an image), its dimension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM