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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:27:14+00:00 2026-05-21T03:27:14+00:00

I have a view to edit some document details and upload two related images.

  • 0

I have a view to edit some document details and upload two related images. I want this view to post to two different actions on my controller, one for saving all the form fields and one to do the file upload.
I have one form around the main form and a multipart form around the file uplaod input

   <% using (Html.BeginForm("Edit", "Document", FormMethod.Post,
                                 new { enctype = "multipart/form-data" })) { %>

    <% =Html.TextBoxFor(model => model.Document.Title) %>
     <%= Html.TextBoxFor(model => model.Document.Description) %>

    //and then another multipart form around the file upload part like this
     <% using(Html.BeginForm("FileUpload", "Document", FormMethod.Post, new { enctype = "multipart/form-data" }))
                <input type="file" id="fileUpload" name="iamge" size="30" />
                <input type="submit" value="Upload" />
                  <% { %>  

<input type="submit" value="Save" />
<% } %>

The file upload is happening correctly on posting the inner form but I want the controller to return the compelte model to the main view again with all the form fields persisited. The view is strongly typed so I thought I would post the whole model to the file upload action using the inner form. Can I get away with having just one multipart form that will post the files and the form data regardless of what input element is clicked? Is this good practice. At the end of the day all I want is to make sure all my form data is persisted on the Edit form after my file upload.

How can I pass the model data to the file upload action from the inner 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-21T03:27:15+00:00Added an answer on May 21, 2026 at 3:27 am

    You don’t need the inner form I don’t think. You can just have the outer form, which should parse in your model if you set up the action arguments. You could then have a different logic path in terms of, for instance, persisting other model elements depending on whether any files had been posted.

    You would then be able to pass the model that had been posted back, back into the view.

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

Sidebar

Related Questions

I have a view and it's composed of two tables. I want to edit
I have two view controllers in a tabbar which can both edit data. Therefore,
I have this code in some of my ASCX files: <%=Html.ActionLink(Resources.Localize.Routes_WidgetsEdit, Edit, Widget, new
I have a edit View - Product/Edit/1 1 being the Id of the Product.How
so i have a Parents controller with list and edit view for it (to
I have editable grid view, If I click on edit in any row say
i have view like 'home/details/5', it can be access by anonymous user. but there
I have a View Controller I'm reusing to edit individual objects (NSString, NSNumber, NSDate)
I have a view using a master page that contains some javascript that needs
I have a table contents many fields db.define_table('i2l_templates', Field('id','id', represent=lambda id:SPAN(A(T('View'),_href=URL('view_template',args=id)),' | ', A(T('Edit'),_href=URL('edit_template',args=id)))),

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.