Uploading a file with custom generated symfony 1.4 forms -


i use module creates customized html forms through template partails

i need manage 4 file uploads of form.

in actions pull field data so:

$alldata = $request->getparameterholder()->getall(); 

which me uploaded file name, need save file uploads dir.

i trying bind form so:

if( isset($customdata['getattachments']) && count($alldata)){         $attachments = $forminput->bind($request->getparameter('forms_input'), $request->getfiles('forms_input')); } 

which succesfully generates $attachments object. sanity check on var_dump($attachments);die; dumps:

object(formsinput)#225 (18) { ["_node":protected]=> null ["_id":protected]=> array(1) { ["id"]=> string(5) "32171" } ["_data":protected]=> array(6) { ["id"]=> string(5) "32171" ["form_uid"]=> string(32) "aef79b2d47722ca154788cc9c8f8de2b" ["data_array"]=> string(770) "a:20:{s:9:... 

how extract file , push directory. tried this:

$file = $attachments->getvalue('file');   if($file) {   $filename = sha1($file->getoriginalname()).$file->getextension($file->getoriginalextension());   $file->save(sfconfig::get('sf_upload_dir').'/'.$formtitle.'/'.$usrdir.''.$filename); } 

but throws error:

unknown record property / related component "value" on "formsinput" 

how can uploaded sf dir?

update

tried use sfvalidatorfile class, cannot figure out how pass parameters $attachment object:

$file = new sfvalidatorfile(); if($file) { $filename = sha1($file->getoriginalname()).$file->getextension($file->getoriginalextension()); $file->save(sfconfig::get('sf_upload_dir').'/uploadeddir'); } 

throws this:

fatal error: call undefined method sfvalidatorfile::save()  

what intended $file->save requires sfvalidatedfile object. if formsinput instance of sfformobject, can configure form 4 sfvalidatorfile path wanted in option. job need.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -