This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

i need csv file upload in symfony1.4

Discussion relating to version 1.3.x and 1.4.x

i need csv file upload in symfony1.4

by roopamani932 » Wed Jul 20, 2011 2:39 pm

hai,

i need support csv file upload in symfony1.4 i tried but no result
please check the below code

protected function processForm(sfWebRequest $request, sfForm $form)
{

$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));

if ($form->isValid())
{
$file = $this->form->getValue('address');
echo $file->getType();

$filename=$file->getTempName();

$filestream = fopen($filename, "r");print_r($filename);
while (!feof($filestream))
{
echo $emailAddressList[] = fgets($filestream);
}
fclose($filestream);
foreach ($emailAddressList as $emailAddress)
{
print_r($emailAddress);
$this->form = new usersForm();
$values = array( "id" => '', "fname" => $emailAddress,"lname" => $emailAddress,"email" => $emailAddress,);
$this->form->bind($values, array());

$users = $form->save();
//print_r($users);

}




//$users = $form->save();



$this->redirect('users/edit?id='.$users->getId());
}
}
roopamani932
Junior Member
 
Posts: 2
Joined: Wed Jul 20, 2011 2:34 pm