Jump to content

Phpman88

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Phpman88

  1. I recently submitted a plugin to WordPress and they told me to sanitize my file name here is the examples they gave me. 

     

    Quote

    basename is great, but you also want to sanitize the filenames

    image-framer/image-framer.php:135: $targetFile = $targetPath . '/imageframer/' . basename($_FILES['image']['name'][$i]);
    image-framer/image-framer.php:138: $returnResponse[$i] = $dir['baseurl'] . '/imageframer/' . $_FILES['image']['name'][$i];
    image-framer/image-framer.php:162: $targetFile = $targetPath . '/imageframer/' . basename($_FILES['uploadimg']['name']);
    image-framer/image-framer.php:165: $returnResponse = $dir['baseurl'] . '/imageframer/' . $_FILES['uploadimg']['name'];
    image-framer/src/Validation.php:13: $imageFileType = strtolower(pathinfo($targetPath . '/imageframer/' . basename($_FILES['image']['name'][$index]), PATHINFO_EXTENSION));

    How would I go about sanitizing file names? Thanks all for your help.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.