Sha256: 5a5e2b11a20b94a342cf5bcf16c67a6dcdb557643e01ac79137093d19a04995c

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

<?php
/*
UploadiFive
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
*/

// Set the uplaod directory
$uploadDir = '/uploads/';

// Set the allowed file extensions
$fileTypes = array('jpg', 'jpeg', 'gif', 'png'); // Allowed file extensions

if (!empty($_FILES)) {
	$tempFile   = $_FILES['Filedata']['tmp_name'];
	$uploadDir  = $_SERVER['DOCUMENT_ROOT'] . $uploadDir;
	$targetFile = $uploadDir . $_FILES['Filedata']['name'];

	// Validate the filetype
	$fileParts = pathinfo($_FILES['Filedata']['name']);
	if (in_array(strtolower($fileParts['extension']), $fileTypes)) {

		// Save the file
		move_uploaded_file($tempFile,$targetFile);
		echo 1;

	} else {

		// The file type wasn't allowed
		echo 'Invalid file type.';

	}
}
?>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redde-0.0.8 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php
redde-0.0.7 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php
redde-0.0.6 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php
redde-0.0.5 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php
redde-0.0.4 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php
redde-0.0.3 lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php