Upload in batch Asp.net MVC5

Asked

Viewed 224 times

3

inserir a descrição da imagem aqui

I’m trying to develop a web system that works as a message-oriented social network.

Having the classes usuario.cs and Informacao.cs (which acts as a message), need to provide attachments in this information, the messages are disclosed on each user’s page, as pages of a blog. A user can send several files along with the message to another user, the part of the messages I already have, what I need now is to implement the attachments. The user should be able to send attachments in their messages and download attachments in other messages.

What kind of attribute do I need? What’s more "healthy" for the system, files saved in the database, or files saved in a reserved directory?

I don’t want the whole controller code ready, I just need directions, what kind of attribute to use, precautions, tips the cleanest way to do this, that kind of help.

Informacao.Cs

public class Informacao
    {
        [Key]
        public int InformacaoID { get; set; }

        [Required(ErrorMessage = "Digite algo.")]
        public String Mensagem { get; set; }

        public virtual Usuario Autor { get; set; }

        [Required]
        public DateTime DataPublicacao { get; set; }


    }

1 answer

2


The user should be able to send attachments in their messages and download attachments in other messages.

Use for this the Backload. It works with most JS multiple upload plugins available. He’s got Nuget pack. He’s freemium: pays nothing to use, but the best functions are paid.

Which is more "healthy" for system, database saved files or files saved in a reserved directory?

It depends on the size of the files. The database does not provide to host very large files. For small files there is not so much problem. You also need to analyze the amount of files used. If they are too large a number, the file system is still a better option. Seems to be your case.

I don’t want the whole controller code ready, I just need directions, what kind of attribute to use, precautions, tips the cleanest way to do this, that kind of help.

A good JS plugin for this is the jQuery-File-Upload. He’s got Nuget pack. Easily integrates with Backload. A demo can be obtained by opening a new project in Visual Studio and installing this other Nuget package. Then just read the examples and run the code.

In domain modeling, create a Model called InformacaoAnexo, and establish cardinality of N for 1 with Informacao.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.