Skip to content

Instantly share code, notes, and snippets.

View ulrischa's full-sized avatar

ulrischa ulrischa

View GitHub Profile
$target_dir = "pic/";
$target_file = $target_dir . 'ndvi.jpg';
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
@ulrischa
ulrischa / phpflatdir.php
Last active January 4, 2016 18:40
Php flat directory tree
<?
$iterator = new RecursiveDirectoryIterator ('rootdir');
$wrapper = new RecursiveIteratorIterator ($iterator, RecursiveIteratorIterator::SELF_FIRST);
foreach ($wrapper as $elem) {
echo $elem->getFilename ();
}
?>
@ulrischa
ulrischa / new_gist_file.php
Created November 30, 2013 20:20
Test php
<?php
echo 'hallo';
?>
@ulrischa
ulrischa / 0_reuse_code.js
Created November 30, 2013 20:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console