C
C#•3mo ago
Gipper

How to go from taking in one photo upload to taking a multiple photo upload

Right now the way I'm doing it is:
public class MyViewModel
{
// some things
public IFormFile Photos { get; set; }
// etc...
}
public class MyViewModel
{
// some things
public IFormFile Photos { get; set; }
// etc...
}
and in the View I pass that ViewModel into I'm taking in the upload like this:
<form asp-action="MyAction" enctype="multipart/form-data">
Things before
<div class="custom-file">
<p for="customFile">Pick an image:</p>
<input asp-for="Photos" class="custom-file-input" id="customFile">
</div>
Things after
</form>
<form asp-action="MyAction" enctype="multipart/form-data">
Things before
<div class="custom-file">
<p for="customFile">Pick an image:</p>
<input asp-for="Photos" class="custom-file-input" id="customFile">
</div>
Things after
</form>
This only allows uploading one photo at a time. Stack Overflow tells me that the way to do multiple would be:
<asp:FileUpload ID="fileImages" AllowMultiple="true" runat="server" />
<asp:FileUpload ID="fileImages" AllowMultiple="true" runat="server" />
But since I didn't even know one can call asp classes in the html tag like that I would really appreciate some help and guidance on how to go from what I currently have to what I want to have.
28 Replies
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
No
Gipper
Gipper•3mo ago
Stack Overflow
How to choose multiple files using File Upload Control?
I have a file upload control.Now on clicking on that, I want to select multiple files. How can I do so?
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
ok, what is this era's way of doing this? 😆
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
nah, it's school that's why I'm just going off what google shows me
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
leowest
leowest•3mo ago
have to also consider that if that is a requirement from his teacher not much he can do, which often happens.
Gipper
Gipper•3mo ago
I don't know what you're referring to the <asp:FileUpload thing I haven't used it nor am forced to use it. I just found it from googling how to allow the upload of several photos...
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
"asp net how to upload multiple images" I think they're just trying to keep it simple, this isn't supposed to single-handedly give you all the skills to be an experienced webdev, it's a single semester class we hadn't even touched on ASP.NET development before How much can you teach in 3-4 months if it's one of 5/6 classes the students are taking? Also keep in mind you haven't seen the whole project and I only come here if I'm really stuck on something so you're probably seeing only the worst parts of this development process
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
they give you the protocol and it's stipulated it's supposed to be ASP.NET MVC with MSSqlServer db, but that's pretty much it you can add anything on top if you want I figured out you can just add multiple to the input tag lol let's see if all the data goes like I want it to through the post
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
I am using aspnetcore 8...I don't understand why you think this is so old? Is it because I use traditional HTML and not the aspnet cshtml things starting with the @?I don't use it because I personally find it confusing
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
I kinda just do things my own way and don't listen to the way teachers do it, I'm just more comfortable doing it my way
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
Like I said, I do not have that in my project nor want to insert it into my project it's just a random thing I found on stack overflow and copied here as an example. I had literally never even seen it before which tells you that I probably am working with the modern stuff as I didn't even knew that existed before coming accross it in google
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
I understand the problem of using old software, and you're right I should be more careful with what I draw from on the internet Not to make excuses but I don't think I ever worked with a framework with so much backward compatibility, other frameworks just don't have such a long history of the ones I worked with at least that's a compliment to .NET :Ok:
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Gipper
Gipper•3mo ago
Thank you, I hope you believe when I say I'm actually trying to help you help me I don't know why my threads always turn into such a mess lately. I probably should be more careful :sadcat:
Unknown User
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
leowest
leowest•3mo ago
@Gipper I wonder thou did your teacher impose u to use asp.net from .net framework or are u free to use newer frameworks? and did u create the latter or former u can check by looking at your csproj file I know u said above aspnetcore8 I just wanted to make sure u checked it in the csproj
Gipper
Gipper•3mo ago
there was no imposition of any framework besides "ASP.NET Core MVC"
leowest
leowest•3mo ago
always good to make that distinction because the volume of people that comes here asking for help with older frameworks like webforms etc is pretty big. good to know your teacher at least gave u newer framework to use and to learn with the latest features of the language
Want results from more Discord servers?
Add your server