Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:55:28+00:00 2026-05-31T05:55:28+00:00

i am trying to upload a video and convert it in php using zend

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:55:30+00:00Added an answer on May 31, 2026 at 5:55 am

    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.

    setDestination() is deprecated, and the Rename filter should be used instead. If you have a Rename filter set, it will override the destination. Otherwise, there isn’t much of a difference. The main difference is that the Rename filter can rename the file, where setDestination keeps the original file name as it was on the user’s PC and only moves it to the destination. This could lead to existing files being overwritten or someone smashing another user’s file if you don’t carefully name them.

    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?

    Personally, I wouldn’t try to convert the file as it is uploaded. While the conversion may be quick in many cases, what happens if a relatively large video was uploaded and it takes an additional 4 minutes to encode the video? You don’t want the user hanging there waiting wondering what is happening while the conversion takes place.

    I would upload the files, copy them to a temporary location where they will be converted and then moved to the original location. This adds complexity of course.

    If you want to convert the videos on the fly as they are uploaded, I may not even bother using Zend_File_Transfer_Adapter_Http at all. Instead, use the $_FILES superglobal to access $_FILES['videofile']['tmp_name'] and have ffmpeg convert that file and just write the output to the final destination, or a temp destination and then move it when conversion completes. Files uploaded to PHP are deleted automatically when the request terminates unless you call move_uploaded_file or manually do something to write the temporary file to a permanent location.

    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?

    Yes, if you go without Zend_File_Transfer. The uploaded file is automatically in a temporary directory until the PHP request terminates. If you do the conversion on the fly, the original temp file is automatically deleted when PHP finishes.

    Hopefully that clears things up a bit for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload a youtube video using the GData gem (I have
I'm trying to upload a video to YouTube using the PHP Data API $yt
I am trying to upload file using php. I am using the function move_uploaded_file.
I'm trying to build a website that will allow user to upload video files
I am trying to upload video from the iPhone application using FBConnect. Actually I
We have a page that accepts video file uploads using a plain <input type=file
We're trying to build a php based video sharing site that allows users to
I am trying to upload video to Wordpress.using following method string expression = videoData.VideoTitle;
I'm trying to get my website to upload video's and pictures. As I have
I'm trying to get my website to upload video's and pictures. As I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.