i am trying to upload a video and convert it in php using zend framework and i have a bit of a problem with my logic.
i have a directory, locally, that needs to hold the uploaded files:
C:/xampp/htdocs/zend/videos/
fist i need to convert the video then move it in that directory.
For conversion im using something like this:
exec("ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x240 video.flv", $out);
here is a part of my form:
$file = new Zend_Form_Element_File('file');
$file->setLabel('File')
->setRequired(true)
//->setDestination('/var/www/tmp') use in real life
->setDestination('C:/xampp/htdocs/zend/tmp')
->addValidator('Size',
false,
array('min' => '10kB', 'max' => '100MB'));
when i upload the file it goes to that directory just fine.
Do i need to convert the file in the tmp
directory and then move it to my other main one, then delete the original one?
Isn't there a way to hold the original file in a temp directory temporary until it gets converted and then it will automatically delete itself?
I am trying also to use Zend_File_Transfer_Adapter_Http
but im a bit confuse on what is the difference in between setDestination
and the target
from the Rename
filter and if there is a need to use it.
i home someone could bring some light into this issue, maybe some best practices.
Thanks