I am having a problem in getting a fileupload on clicking a link on my navigation bar.
I am using mvc 4 and have a controller that loads the file in and checks it is ok, i can get this done through a input method but it doesn't look nice and want to make the UI a bit slicker so what i have is a link button called upload. what i want to do is call the FormMethod.post with the required upload details. I am very new to this so forgive me if its a simple question.
<li><a href="#" onclick="fileUpload()">upload</a></li>
this works
@using (Html.BeginForm("Upload", "Authenticated", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<fieldset>
Select a file : <input type="file" name="file" />
<input type="submit" value="Upload" />
</fieldset>
}
Regards
Aidan
Finally got this to work I needed to add <input type="file" name="file" hidden="true" onchange='this.form.submit();'/>
and this allowed it to fire the item off.
Thanks for the tips @David.
Regards
Aidan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.