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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:08:04+00:00 2026-06-07T13:08:04+00:00

What are the ways to render the input value filename and send it to

  • 0

What are the ways to render the input value filename and send it to a controller :

<div id="fileuploaddiv" class="fileuploaddivclass">
<form action="@Model.FormAction" method="@Model.FormMethod"
    enctype="@Model.FormEnclosureType">
<input type="hidden" name="key" value="uploads/${filename}" id="filename" />
<input type="hidden" name="AWSAccessKeyId" value="@Model.AWSAccessKey" />
<input type="hidden" name="Content-Type" value="image/jpeg">
<div>
    Please specify a file, or a set of files:
    <input type="file" name="file" />
</div>
<input type="submit" value="Upload" />
</form>
</div>
  • 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-07T13:08:06+00:00Added an answer on June 7, 2026 at 1:08 pm

    You need to look up some MVC3 conventions (I’d recommend NerdDinner as a good starting tutorial), but here is a somewhat similar approach to what you want to do:

    @Model YourViewModel
    <div id="fileuploaddiv" class="fileuploaddivclass">
        @using(Html.BeginForm(Model.FormAction, Model.FormController, FormMethod.Post)
            @Html.HiddenFor(model.key => ${fileName})
            @Html.HiddenFor(model.AWSAccessKeyID)
            @Html.HiddenFor(model.Content-Type)
            @<input type="submit" value="Submit My Form" />
        @Html.EndForm()
    </div>
    

    Your model would look like (And I’m confused here because you seem to be dynamically setting the controller and action, which is unusual):

    public class YourViewModel
    {
         public string FormAction { get; set; }
         public string FormController { get; set; }
         public int AWSAccessKeyID { get; set; }
         public string Content-Type { get; set; }
    }
    

    Now on to controllers:

    [HttpGet]
    public ActionResult WhateverControllerName()
    {
        YourViewModel yvm = new YourViewModel();
        //Initalize viewmodel here
        Return view(yvm);
    }
    
    [HttpPost]
    public ActionResult WhateverControllerName(YourViewModel yvm)
    {
        if (ModelState.IsValid) {
            //Do whatever you want here. Perhaps a redirect?
        }
        return View(yvm);
    }
    

    Note: I am garbage at syntax, so you’ll have to check this, but Visual Studio should tell you what works.

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

Sidebar

Related Questions

I can think of a million not-so-automatic ways to render a model in Rails,
I've tried several ways to get this to render correctly. I want my logo
i am looking for ways to skip the HTTP 202 reponse send back by
The title ways it all. I want to use a cookie to send some
One action of one of my controllers needs to generate(redirect/render) two separate views simultaneously
What ways there are for doing a one way XML serialization in .Net? XmlSerializer
Currently I have 2 ways of displaying images in a cell, which way will
I'm looking for ways of getting rid of Windsor Xml configuration files. I want
There are couple of ways to access azure storage services. And I wanted to
I found three ways to cast a variable to String in JavaScript. I searched

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.