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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:12:27+00:00 2026-05-26T01:12:27+00:00

I am trying to implement file upload with jqgrid (in a Zend Framework project).

  • 0

I am trying to implement file upload with jqgrid (in a Zend Framework project). jqgrid allows you to create an input field of type “file” but does not enable ENCTYPE=“multipart/form-data”.

The creator recommends using another plugin to handle file uploads, specifically Ajax File Upload. He says to initialize it using the onInitializeForm() method but exactly how to do this is not clear to me. He says,

“Also as I suggest you can use Ajax
file upload plugin and intialize it
only once in onInitializeForm event.”

And that is about it for instructions on how to do this.

What I have done so far:
I have the jqgrid edit form displaying the file input field and I have all of the various plugin files in place and loading properly. What I cannot figure out is how to get the submitted form to properly upload the file (I guess I can’t figure out how to “initialize the ajax file upload plugin with the onInitializeForm event”). Any ideas are greatly appreciated.

For what it is worth I can get onInitializeForm to trigger something simple like alert(‘test’) but it triggers in growing numbers each time you load the grid (like, nothing first time, one alert the next time you load the grid, two alerts the next time, etc).

  • 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-26T01:12:28+00:00Added an answer on May 26, 2026 at 1:12 am

    The Answer is as like:

    <!-- Add your other js files like jQuery, jqGrid etc. -->
    <script type="text/javascript" src="js/ajaxfileupload.js"></script>
    <script language="javascript">
        $(function() {
            $(document).ready(function() {
                jQuery("#your_grid_id").jqGrid({
                    url: 'your_url',
                    datatype: 'json',
                    mtype: 'post',
                    pager: 'your_pager_id',
                    colNames: ["Description", "File"],
                    colModel: [{name: "desc", index: "desc", ... ... ...}, {name: "file_to_upload", index: "file_to_upload", edittype: "file", ... ... ...}]
                }).navGrid("#your_pager_id",{{... ... ...},{
                    jqModal:true,closeAfterEdit: true,recreateForm:true,onInitializeForm : function(formid){
                        $(formid).attr('method','POST');
                        $(formid).attr('action','');
                        $(formid).attr('enctype','multipart/form-data');
                    }, afterSubmit : function(response, postdata){
                           $.ajaxFileUpload({
                              url: 'your_file_url_where_upload_operates', 
                              secureuri:false,
                              fileElementId:'file_to_upload',
                              dataType: 'json',
                              success: function (data, status) {
                                  alert("Upload Complete.");
                              }
                           });
                       }
                    }},{
                    jqModal:true,closeAfterAdd: true,recreateForm:true,onInitializeForm : function(formid){
                        $(formid).attr('method','POST');
                        $(formid).attr('action','');
                        $(formid).attr('enctype','multipart/form-data');
                    }, afterSubmit : function(response, postdata){
                           $.ajaxFileUpload({
                              url: 'your_file_url_where_upload_operates', 
                              secureuri:false,
                              fileElementId:'file_to_upload',
                              dataType: 'json',
                              success: function (data, status) {
                                  alert("Upload Complete.");
                              }
                           });
                       }
                    }
                });
            });
        });
    </script>
    

    I used recreateForm: true to ensure that on every Add or Edit the form is re-created.

    If you have problem yet, please feel free to ask me.

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

Sidebar

Related Questions

I'm trying to craete a site which allows users to upload any file type
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
So Im trying to implement a file upload functionality where when a user uploads
I'm trying to create an upload file, and email as an attachment form where
I'm trying to implement file upload functionality in the iPhone app. Server code is
I am trying to implement a multiple file upload where I am right now
I am trying to implement file upload functionality on my site. I have created
With HTML 5 i am trying to implement the file upload functionality. Now if
I am trying to implement a multiple file upload script to codeigniter. the script
I'm trying to implement this method of making a nice form upload: www.kavoir.com/2009/02/styling-file-upload-select-input-control-input-typefile.html/ which

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.