Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
can any one help me a sample code for File upload dialog in MVC C#.
It should have a ADD button , when click on ADD button it popup a dialog
with File upload option along with some text box.

What I have tried:

Tried with simple form but not with popup.
Posted
Updated 26-Sep-22 23:05pm

1 solution

<input type="file"> - HTML&colon; HyperText Markup Language | MDN[^]

NB: You cannot modify the dialog that pops up. If you want to upload additional values with the file, you need to provide separate fields on your form to enter them, along with the <input type="file">.
 
Share this answer
 
Comments
Mukesh Ghosh 27-Sep-22 5:40am    
I have tried this, but i want a modal popup where it should have fileuploader & some other control like textbox. so when form submit in Action Method file & other details will be available.
Richard Deeming 27-Sep-22 5:41am    
Read my answer again: YOU CANNOT MODIFY THE FILE DIALOG.
Mukesh Ghosh 27-Sep-22 6:14am    
i don't want to modify file dialog.
My requirement is
1. Add button on a page
2. Click on Add Button , a small window will open, it should have Text Box for input & a File Dialog & a submit button.
3. When click on submit , in Action method, file & Text box value will be available that's all.
Richard Deeming 27-Sep-22 6:16am    
You cannot modify the file dialog. You cannot embed the file dialog in your window. All you can do is use an <input type="file"> to display the system dialog to allow the user to select the file to upload.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900