Problem with fileupload in MVC Structure.
Posted: Tue Feb 01, 2011 6:39 am
hi i have a problem with fileupload iam using the following code to upload the file. that is userdefine mvc structure. i have checked the all those thing simple file upload script is working but when i call the views that time file is not moving the folder.
Pl Help...................
Thanks
Pl Help...................
Code: Select all
<?php
Class diesController Extends baseController {
public function Adminarea()
{
$this->registry->template->blog_heading = 'This is the blog Index';
$this->registry->template->show('dies');
}
public function insert()
{
$db = new person();
$filename=$_FILES["file"]["name"];
$random_digit=rand(0000,9999);
$newname = 'upload/'.$random_digit.$filename;
$path = 'upload/'.$random_digit.$filename;
//$tmp=$_FILES["file"]["tmp_name"];
$newpath= move_uploaded_file($_FILES["file"]["tmp_name"],$path);
echo $newpath;
$handle = fopen ("./$path", 'r');
$rs=$db->uploaddata($handle);
if(!$rs)
{
$this->registry->template->blog_heading = 'Pl try Again.........';
$this->registry->template->show('showmessage');
}
else
{
$this->registry->template->blog_heading = 'Record Inserted Successfully';
$this->registry->template->show('showmessage');
}
}
}