improving coding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
theBond
Forum Newbie
Posts: 19
Joined: Thu Jul 17, 2008 7:46 pm

improving coding

Post by theBond »

I am looking for some guideline to improve coding of file uploading

i am using a single variable called $act to decide the respective action should be taken.

it starts on delete
$id = $_GET['id']
if($act=='delete')
{
//getting the existing file name through $id
//unlink it
//delete the filename
//check delete has happened and give message
}


if($act == 'add_edit')
{
//get the cat id
//get the sub cat id
//get cat name using cat id
// get sub cat using sub cat id

//if catname dir not exist create
//if subcatname dir not exist create it

//check for errors like empty filename, desc etc

//insert if id not exist
//update if id exist

//if image is uploaded then upload image
// update the newly inserted image name
// check its inserted or updated
// give respective message
}

if($act=='form')
{
//show html form

}


if($act == 'paging')
{
// 30 line
}


.....atlast its end................................................................
.......................................................................................

Thanks
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: improving coding

Post by ghurtado »

theBond wrote:I am looking for some guideline to improve coding of file uploading
My guideline is: write some code that handles file uploads. That would be a pretty big improvement. The "code" you posted has nothing to do with that.

Also, please use PHP tags around your code, or some people may decide not to read it and move on. You have been asked to do this before.
Post Reply