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 9167181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:39+00:00 2026-06-17T15:19:39+00:00

I use Zend Framework 1.12 for some file upload system. And using Zend_File_Transfer_Adapter_Http in

  • 0

I use Zend Framework 1.12 for some file upload system. And using Zend_File_Transfer_Adapter_Http in a form, for upload of two files.
There are two form elements for those two files.

$file1 = new Zend_Form_Element_File('file1');
// other options like setLabel etc.
$this->addElement($file1, 'file1');

$file2 = new Zend_Form_Element_File('file2');
// other options like setLabel etc.
$this->addElement($file2, 'file2');

and I handle the upload process in my controller like this:

if ($request->isPost()) {
                    if ($form->isValid($request->getPost())) {

                        $adapter = new Zend_File_Transfer_Adapter_Http();
                        $adapter->setDestination($dirname);
                        $files = $adapter->getFileInfo();

                        foreach ($files as $file => $fileInfo) {


                            if (!$adapter->receive($file)) {
                                $messages = $adapter->getMessages();
                                echo implode("\n", $messages);
                            } else {
                                $location = $adapter->getFileName($file, true);
                                $filename = $adapter->getFileName($file, false);


                               // taking location and file names to save in database..
                            }
                        }
                    }

With these, I can manage upload of two files. But I don’t know how to take location of files which is uploaded with the specific Zend_Form_Element_File. For example, i need to know which file is uploaded to $file1 (element in form) and I will save its location to a table in database, and which file is uploaded to $file2 and save its location to another table.

  • 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-06-17T15:19:40+00:00Added an answer on June 17, 2026 at 3:19 pm

    I do not like to use Zend_File_Transfer_Adapter_Http.
    I prefer to use code like this:

    in application.ini:

    data_tmp = APPLICATION_PATH "/../data/tmp"
    

    in Bootstrap:

    $options = $this->getOptions();
    define('DATA_TMP', $options['data_tmp']);
    

    in form:

    $elementFoo = new Zend_Form_Element_File('foo');
    $elementFoo->setLabel('Upload File 1:')->setDestination(DATA_TMP);
    
    $elementBar = new Zend_Form_Element_File('bar');
    $elementBar->setLabel('Upload File 2:')->setDestination(DATA_TMP);
    

    in controller:

    if ($request->isPost()) {
        if ($form->isValid($request->getPost())) {
           $values = $form->getValues();
           $filenameFoo = $values['foo'];
           $filenameBar = $values['bar'];
           //at this point you know the name of the individual filename
           $filePathFoo = DATA_TMP . DIRECTORY_SEPARATOR . $filenameFoo;
           $filePathBar = DATA_TMP . DIRECTORY_SEPARATOR . $filenameBar;
           //now you have even the physical path of the files
    
           // taking location and file names to save in database..
        }
    }
    

    my 2 cent.

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

Sidebar

Related Questions

I'm doing some form in Zend Framework for file upload on Apache friends -
I am using Zend Framework 1.12. I wanted to add some routers. There are
I am using the Zend Framework, and I use the .htaccess for some settings.
I have a Zend Framework project using version 1.10.8 with Doctrine 1.2.4.I use Zend_Auth
I wrote a command line utility using Zend Framework to do some nightly reporting.
In my application (using Zend Framework), I have a layout file ( layout.phtml )
I am using zend framework 1.10. I use the zf tool to create controllers,
This article explains how to use Zend in Codeigniter. http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/ I am using XAMPP
I'm trying to use Zend_ProgressBar in my project (made using MVC in Zend Framework).
I'm using the Zend Framework to create an API I want to use apache

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.