Simple multiple upload function in php

Posted on: November 3rd, 2014 by Theepan


[codesyntax lang=”html4strict”]

<form method="post" action="uploadme.php" enctype="multipart/form-data">
		<input type="file" name="uploadme[]" multiple="multiple" />
		<br />
		<input type="submit" name="submit" />


PHP Function

[codesyntax lang=”php”]

function single_file($files) {
			$newone = array();
			foreach($files as $key => $array) {
				foreach($array as $i => $value) {
					$newone[$i][$key] = $value;
			return $newone;
		function upload($file, $destination, $allowed_exts) {
			$ext = strtolower(end(explode('.', $file['name'])));
			if(!file_exists($destination)) {
				mkdir($destination, 0777, true);
			if(in_array($ext, $allowed_exts)) {
				if(move_uploaded_file($file['tmp_name'], $destination . "/" . basename($file['name']))) {
					echo "File " . basename($file['name']) . " uploaded. <br />";
				} else {
					echo "File " . basename($file['name']) . " could not be moved. <br />";

			} else {
				echo "File " . basename($file['name']) . " not supported. <br />";
		$files = single_file($_FILES['uploadme']);
		$destination = "uploads/images";
		$allowed_exts = array('jpg', 'jpeg', 'png');
		foreach($files as $file) {
			upload($file, $destination, $allowed_exts);


Quick use of timthumb in WordPress

Posted on: April 27th, 2014 by Theepan

[codesyntax lang=”php”]

<?php if(has_post_thumbnail()): ?>
	$post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array(628, 310), false, '');
	$img_src = $post_thumbnail_src[0];
	<img src="<?php bloginfo('template_url'); ?>/inc/timthumb.php?src=<?php echo $img_src;?>&w=628&h=310&zc=1q=100" />
<?php endif; ?>


How would you add events to elements which are added by jQuery?

Posted on: November 3rd, 2013 by Theepan

We sometimes have to add elements to the DOM by jQuery. If we want to add events to those elements that wont work. But there  was a simple way to add events by using the .live() event/function.

[codesyntax lang=”javascript”]

	$('.content').html('div class="btn">Button</div>'); // Adding a button DIV using jQuery



Change nextgen album thumbnail size

Posted on: September 19th, 2013 by Theepan

In the file

Line 155

WordPress useful codes

Posted on: July 3rd, 2013 by Theepan

Get the post type. Put it in single.php file (more…)

Mulitlevel Responsive Menu with CSS and jQuery

Posted on: June 29th, 2013 by Theepan

Hello, I had to make a responsive menu for one of my client’s website. After searching for a clean coded but good looking responsive menu I realized that I can make a one instead of wasting my time online.  (more…)

Send email with php and jQuery Ajax function

Posted on: June 10th, 2013 by Theepan

The html markup for the form


Introduction to PDO

Posted on: June 5th, 2013 by Theepan

PDO refers to Php Data Objects. This is the latest and most powerful extension. It has many features inbuilt. This class is coming with php 5.1 and above. As per the team says mysql_connect function will be removed in the future. It is good idea to switch to PDO method now so that we wont be running issues when server php version upgraded.

Detailed mascot design Inspirations

Posted on: December 13th, 2011 by Theepan

There are number of Mascot designers that I follow. They all very best in drawing characters. I have put some of them as Inspiration fot this week. Hope you enjoy too. (more…)

WordPress theme psd 01

Posted on: September 29th, 2011 by Theepan

Here is a wordpress theme design. You can use it for your own projects or commercial projects. This design has no restriction to use part of the design or full design except the photos used in this theme. Please consider that photos are copyrights to corresponding photographers. (more…)