improving coding
Posted: Fri Aug 22, 2008 7:46 am
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
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