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

  • Home
  • SEARCH
  • 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 6336887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:08:40+00:00 2026-05-24T19:08:40+00:00

Im currently working with zend framework. Im working on a form to create a

  • 0

Im currently working with zend framework.

Im working on a form to create a new provider and they can upload an image to it.

So my code is to create a new provider row in the provider table and then retrieve the provider id for creating a new image folder for the provider.

Eg if provider id = 10 the code will create a folder of public/images/providers/10

And then insert the image into the new image directory.

The werid thing is that if I remove $data = $form->getValues();before receiving the image, it works but whenever $data = $form->getValues() before receiving the image it doesn’t work.

So my question is how can I solve this issue since i needed the form values to insert a new provider row in order to store the image in the provider directory.

Can someone please help me out?

Thanks so much in advance.

Here is my code (please note my zend_form_element_file named “logo” in my form)

public function processNewProviderAction()
    {
          $this->_helper->layout->setLayout('admin');

         $form = $this->getNewProviderForm();

            if ($form->isValid($_POST))
                {

                    $data = $form->getValues();

                    // Insert into provider table
                    $createdBy = 1; // need to get the system User Id
                    $providers = new Application_Model_DbTable_Providers();
                    $providerId = $providers->insertProvider($data, $createdBy);


                 if($form->logo->isUploaded())
                        {

                                    if(isset($providerId))
                                    {
                                            //set the directory for file upload
                                            $directory =            APPLICATION_PATH . '/../public/images/providers/' . $providerId;
                                            if(is_dir($directory))
                                            {//directory exist
                                            }
                                            else
                                            {//create directory
                                                    mkdir($directory, 0777); //0777 is the default which gives the widest access
                                            }

                                            $adapter = $form->logo->getTransferAdapter();
                                            $fileName = $adapter->getFileName('logo');

                                             //getting the extension
                                            $info = pathinfo($fileName);
                                            $baseName = $info['filename'];
                                            $ext = $info['extension'];

                                            $fileName =  $baseName . '.' . $ext;

                                            $attachmentUploadElement = $form->getElement('logo');
                                            $attachmentUploadElement->addFilter('Rename', $directory . '/' . $fileName);
                                            try 
                                                {

                                                    // upload the file
                                                    $form->logo->receive();

                                                }
                                            catch (Zend_File_Transfer_Exception $e)     {        $e->getMessage();    }





                                    }


            }





                }
     else
         { //Form is invalid

          $this->view->form = $form;


         }




    }
  • 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-24T19:08:42+00:00Added an answer on May 24, 2026 at 7:08 pm

    I think i worked out.

    Don’t worry about it 🙂

    Have to add this line to it

    ->setValueDisabled(true);
    

    For more info please visit

    http://www.thomasweidner.com/flatpress/2009/04/17/recieving-files-with-zend_form_element_file/

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

Sidebar

Related Questions

I am currently working with the Zend Framework and I use PHPEd as my
Hi I'm currently working on some php - zend framework project on my osx
I'm currently working on a project where I use Zend Framework with Propel. I'm
I'm working on a project that is currently using the Zend Framework 1.7.6, however
I'm currently working on creating a new C# project that needs to interact with
In my Zend Framework project, I have a form that I am testing. In
I'm working on a project now that isn't based on Zend Framework, however I
I am working on implementing Zend Framework within an existing project that has a
I currently working on an issue tracker for my company to help them keep
I am currently working on a project and my goal is to locate text

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.