Skip to content

Instantly share code, notes, and snippets.

@DavidMellul
Created March 1, 2018 20:44
Show Gist options
  • Save DavidMellul/e7c36e3e434af1c5c733a4aed70b95c1 to your computer and use it in GitHub Desktop.
Save DavidMellul/e7c36e3e434af1c5c733a4aed70b95c1 to your computer and use it in GitHub Desktop.
<?php
$path = $_FILES['image']['name'];
$extension = pathinfo($path, PATHINFO_EXTENSION);
$allowed_extensions = array('png','jpg','bmp','gif');
if (in_array($extension, $allows_extensions)) {
upload_file();
chmod($path, 0644);
}
else
showErrorMessage();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment