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
improving coding
Moderator: General Moderators
Re: improving coding
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.theBond wrote:I am looking for some guideline to improve coding of file uploading
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.