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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:33:32+00:00 2026-06-15T23:33:32+00:00

I am trying to include xupload extension for yii in the CActiveForm I try

  • 0

I am trying to include xupload extension for yii in the CActiveForm I try to follow this http://www.yiiframework.com/wiki/395/additional-form-data-with-xupload/
However I cannot make it. I have a form which has the field of username and filename (allow user to upload and view it from the view.)
this is my view

<?php
$form = $this->beginWidget('CActiveForm', array(
      'id' => 'form-form',
      'enableAjaxValidation' => false,
        //This is very important when uploading files
      'htmlOptions' => array('enctype' => 'multipart/form-data'),
    ));
  ?>    
    <div class="row">
        <?php echo $form->labelEx($model,'username'); ?>
        <?php echo $form->textField($model,'username'); ?>
        <?php echo $form->error($model,'username'); ?>
    </div>
    <!-- Other Fields... -->
    <div class="row">
        <?php echo $form->labelEx($model,'attachment_photo'); ?>
        <?php
    $this->widget('xupload.XUpload', array(
        'url' => Yii::app()->createUrl("form/uploadAdditional", array("parent_id" => 1)),
        'model' => $model,//An instance of our model
        'attribute' => 'file',
        'multiple' => true,
        //Our custom upload template
        'uploadView' => 'application.views.site.upload',
        //our custom download template
        'downloadView' => 'application.views.site.download',
        'options' => array(//Additional javascript options
            //This is the submit callback that will gather
            //the additional data  corresponding to the current file
            'submit' => "js:function (e, data) {
                var inputs = data.context.find(':input');
                data.formData = inputs.serializeArray();
                return true;
            }"
        ),
    ));
    ?>
  • 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-15T23:33:33+00:00Added an answer on June 15, 2026 at 11:33 pm

    The important thing is what your $_POST array looks like. (Check this with Firebug, or Fiddler).

    Your $_POST should look like this:

    array (
      'form-form' => array ( /* stuff for additional form data */)),
      'XupLoad' => array ( /* stuff pertaining to XuLoad */)),
    )
    

    In this way, the additional form data is separate from the XupLoad data. The action as included in the Xupload extension handles the $_POST['XupLoad'] part of the array. You will have to write code to handle the $_POST['form-form'] part of the array.

    By the way, Blueimp’s jQuery File Upload has a new version with important improvements and bug-fixes. It does not look like the XupLoad extension includes this latest version.

    I would suggest going with Blueimp’s latest version. It has an UploadHandler class that takes care of everything server-side. The latest version is really well written. You will still have to add code for handling the additional form data…

    afterthought: It looks like you are nesting your widgets. I am not sure that this could work. Check the page source in your browser. Make sure that the HTML generated is sound. It could be that you are generating nested forms, and I have my doubts about how those would work.

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

Sidebar

Related Questions

I was trying Include extension method from http://damieng.com/blog/2010/05/21/include-for-linq-to-sql-and-maybe-other-providers , but it does not really
I'm trying include this barcode source code Stefanhafeneger - Barcode github.com to my project
While trying to include my own class library in Yii . I used this
Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is
I'm trying to include an extension methods static class in a dynamically generated assembly,
I am trying to include source code in bullet lists with reStructuredText; like this:
Trying to include simple HTML5 page instead of scala templates.. For this I have
I'm trying to include db.php and pass a variable to it. This is what
I am trying to include ngen to my installer using this article . I
I am trying to include this du -s *|awk '{ if ($1 > 3000)

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.