Page 1 of 1

Problem with fileupload in MVC Structure.

Posted: Tue Feb 01, 2011 6:39 am
by manojsemwal1
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...................

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');
		  }

}


}
Thanks

Re: Problem with fileupload in MVC Structure.

Posted: Wed Feb 02, 2011 12:16 pm
by Jade
Check to make sure you still the correct path and the folder you're moving the file to has the correct permissions.

Re: Problem with fileupload in MVC Structure.

Posted: Wed Feb 02, 2011 10:59 pm
by manojsemwal1
thanks

I have solved the problem this is due to wrong folder placement...........

but when i have upload the csv file on database some records are not inserted into database due to datatype problem so how can i know that which data has missed to upload............

Pl help.
thanks for your reply..........

Re: Problem with fileupload in MVC Structure.

Posted: Thu Feb 03, 2011 10:21 am
by Jade
It probably has to do with your database's character set or the type of field you're uploading the data to ie. maybe its being truncated.