[TYPO3-project-formidable] Upload and rename a file

Jerome Schneider j.schneider at ameos.com
Fri May 11 13:15:48 CEST 2007


Hello jeremy :)

Yeap this could be a solution ; Another would also be to use

datahandler/process/beforeinsertion/

with a userobj like this:

<datahandler:DB>
	<!-- ... your xml stuff -->
	<process>
		<beforeinsertion>
			<userobj>
				<php><![CDATA[

	$aData = func_get_arg(1);

	$sFileName = $aData["some_rdt_file"];
	$sNewFileName = 
$this->aORenderlets["some_rdt_file"]->_MakeCoolFileName("mynewfile_" . 
$sFileName);

	$sAbsPath = 
$this->aORenderlets["some_rdt_file"]->getFullServerPath($sFileName);
	$sNewAbsPath = 
$this->aORenderlets["some_rdt_file"]->getFullServerPath($sNewFileName);

	@rename($sAbsPath, $sNewAbsPath);
	$aData["some_rdt_file"] = $sNewFileName;

	reset($aData);
	return $aData;

				]]></php>
			</userobj>
		</beforeinsertion>
	</process>
</datahandler:DB>



I think this will do the trick in an easier manner because you don't 
have to update anything in DB manually this way
Maybe will you need also a redirect after this, if on-screen data does 
not correspond to what's in DB


Ciao :)
Jerome

Jérémy Lecour a écrit :
> Maybe it would be good to make a specific Actionlet or use the
> "Userobj" Actionlet with a specific PHP function
> 
> Am I right ?
> 
> 2007/5/11, Jérémy Lecour <jeremy.lecour at gmail.com>:
>> Hi,
>>
>> I'm finally getting into migrating my old customized v0.5 into a
>> (still) standard v0.7
>> I know I's going to be tough with some special customizations I've
>> made, but I need to go forward.
>>
>> I'd like to upload a file and rename it depending on some other fields 
>> values.
>> What would be the best way ?
>>
>> Thanks for any advice
>>
>> -- 
>> Jérémy Lecour : <mailto:jeremy.lecour at gmail.com>
>> webdesigner, webmaster et développeur web
>> Provence Linux User Group : http://www.plugfr.org/
>> _______________________________________________
>> TYPO3-project-formidable mailing list
>> TYPO3-project-formidable at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable 
>>
>>
> 
> 


More information about the TYPO3-project-formidable mailing list