Hmm, Let me play around with it and see if I can write a RegexRename filter. I imagine it won't be too difficult :)
On Fri, Feb 6, 2009 at 12:11 AM, Eric Haskins <cybertuff...@verizon.net>wrote: > AJ, > > $upload = new Zend_File_Transfer_Adapter_Http(); > > $upload->addValidator('Size', false, 200000, 'file1'); > > $upload->setDestination('/home/titslike/public_html/tmp/'); > > $files = $upload->getFileInfo(); > > $i=0; > > > > foreach ($files as $file => $info) { > > if($upload->isValid($file)){ > > $ext = pathinfo($info['name']); > > $upload->addFilter('Rename', array('target' => > '/home/titslike/public_html/tmp/image_'.$userid.'_'.date('Ymdhs').'.'.$ext['extension'], > 'overwrite' => true),'file1'); > > $upload->receive($file); > > $i++; > > } > > } > > > > Here was my final fix you have to give full path to the file. Im not sure > on the regex but I am interested in your resolution as I would love to add > that filter on a diff project > > > > Eric Haskins > > > > > > *From:* A.J. Brown [mailto:fynw...@gmail.com] > *Sent:* Thursday, February 05, 2009 9:26 AM > *To:* Ehask71 > *Cc:* fw-general@lists.zend.com > *Subject:* Re: [fw-general] Zend_File_Transfer_Adapter_Http() Rename > Filter issue > > > > Hey Thomas & Eric, > > I've actually come accross this same issue last night, except I was trying > to use the PregReplace filter. My goal was to strip all characters from the > name, except those that I allow (which is alphanumerics plus underscore and > period). > > Here's my code. Note line 41 (and yes, I know I spelled injestion wrong > :)): > > http://pastebin.com/m4c6060c3 > > And here's the value of injestion->filenameRegex in my config.xml: > > <filenameRegex><![CDATA[/[^a-z1-9\-_ ]/i]]></filenameRegex> > > > After upload, the filename is not replaced. Will I have to actually use > Rename? How do I accomplish this with my current code, since I won't know > what the new name should be at the form level? > > On Wed, Feb 4, 2009 at 8:15 PM, Ehask71 <cybertuff...@verizon.net> wrote: > > > Thx Thomas > > I didnt see the 'target' array key?? The only example I saw that mentioned > it was for changing destination. I guess you get to a point when trying so > many examples you start losing site LOL > > Eric > > > -- > View this message in context: > http://www.nabble.com/Zend_File_Transfer_Adapter_Http%28%29-Rename-Filter-issue-tp21823191p21844596.html > > Sent from the Zend Framework mailing list archive at Nabble.com. > > > > > -- > A.J. Brown > web | http://ajbrown.org > phone | (937) 660-3969 > -- A.J. Brown web | http://ajbrown.org phone | (937) 660-3969