Archive

Posts Tagged ‘PHP’

Simple File Upload Script in PHP

June 30th, 2010 kumarasamy No comments
Here goes my file upload component in PHP. It just uploads the file into the specified directory.Other thing i have added as of now is it’ll upload the files into the folder on the current month and checks for the file exists already or not, if it already exists then it’ll prefix the time in milliseconds in the file name.
	<?php

		/*
		*		Copyright 2010 - Kumarasamy
		*		kumarasamy@techmaddy.com
		*/

		class DocumentHandler {

			var $uploadDir;// Directory where the documents to be uploaded

			function prepateForUpload() {
				$this->uploadDir = '/var/www/uploads';
				$this->uploadDir = $this->uploadDir . "/" . date("Y_m");

				//Check the month folder is available, if not then create it.
				if(!is_dir($this->uploadDir))
					mkdir($this->uploadDir);

			} //End of setDetails

			function copyFile($_FILES,$fileCntrlName) {
				$resultArray = array();
				$uploadfile = $this->uploadDir . "/" . basename($_FILES[$fileCntrlName]['name']);

				//If the file exists already in the folder, append the millisecond in the file name.
				if(is_file($uploadfile)) {
					list($msec, $sec) = explode(".", microtime(true));
					$uploadfile = $this->uploadDir . "/" . $msec . $sec . basename($_FILES[$fileCntrlName]['name']);
				}

				if (move_uploaded_file($_FILES[$fileCntrlName]['tmp_name'], $uploadfile)) {
					$resultArray['error'] = '';
					$resultArray['displayMessage'] = 'File Uploaded Successfully!!!';
				}

				return $resultArray;
			} //End of copyFile

		} //End of DocumentHandler
	?>
	
The following things can be added,

  • Check for the file type
  • Check for the file Size
  • Scan the document using the shell commands
  • Check for the special chars in the file name
  • File name length check also can be added
Idea’s are accepted!!!
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Issue Tracking System With SAAS Model

June 17th, 2010 kumarasamy No comments
I was not able to write on my blog, since my concentration was little diverted to my old pending task of completing the SaaS based issue tracking system, Actually the idea started in 2007, when my boss asked manojbabu to look for an issue tracking system. And started coding for two or three pages, then stopped after that, due to some other important work. Now thought of starting it again and since i lost the previous code I’ve started again from scratch. i.e Writing a Class for DB Connection and for Grid View as well, including JavaScript and luckily i have got the images from Manojbabu.Thanks to him for the designs.I’m still brain storming for many ideas. But the basic skeleton is ready.
Since i said this follows SaaS model, we need a to establish the master data, we need many interfaces for this it self.Even though the requirements are pretty similar it took little more time than the expected, this is since i lost the touch in Coding and in LAMP stack tooo. It was a great fun to go back to LAMP and code again. Following screen shot shows how does an admin establishes the master for a company from scratch including from creating a new company.
Login Page
Login
Admin Page with All the Master Data Creation Page
Admin Home
Grid View with Pagination
Grid View
Form Validation With AJAX
Forms
Creating an Issue
Issue Creation
Search For an Issue
Search an Issue
Search For an Issue Result with a Special Image for Edit
Issue Result Grid
Features that are really in need and to be implemented are

  1. File Upload is still pending, since i need to learn that clearly and write a generic component :(
  2. Grid View Can get a Search Bar.
  3. Exporting to Other Microsoft Office Formats.
  4. Revision History is Not Complete Yet.
  5. UI improvements for Changing the Status of a Issue.
  6. and goes on.
During my brain storming, i have got lot of ideas, to be implemented are

  1. JQuery can be used to improve the UI
  2. LAMP can use MemChache module to improve the performance
  3. Can be integrated with Twitter,RSS and SMS
  4. LDAP authentication
  5. Multi language and DB support.
There are many options like this, but i don’t know how far go ahead and do it. After completing the necessary features, i’ll be attempting to integrate with Twitter and RSS.
Very seriously i’m laughing @ me because we have 100’s of open source web application available for Issue tracking, i don’t understand whats the fun in developing one more on the same, End of the day i’ve brushed by LAMP knowledge to the level, but the not upto the mark what i’ve learned from my Guru in Baba9.
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

GigaJob in India…

March 24th, 2010 kumarasamy No comments
Gigagob in India……Happy to be an Linked Partner….
Gigajob Link Partner
I”m little proud that was part of this community long back….:-). And waiting for nallo.de
Here is the Team….
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Categories: General Tags: , , ,
Get Adobe Flash playerPlugin by wpburn.com wordpress themes