Batch upload Asp.net MVC5

3

I'mtryingtodevelopawebsystemthatworksasamessaging-orientedsocialnetwork.

Havingtheclassesusuario.csandInformacao.cs(whichworksasamessage),Ineedtomakeattachmentsavailableinthisinformation,messagesarepostedoneachuserpage,suchaspagesofablog.Ausercansendseveralfilesalongwiththemessagetoanotheruser,thepartofthemessagesIalreadyhave,whatIneednowistoimplementtheattachments.Theusershouldbeabletosendattachmentsintheirmessagesanddownloadattachmentsinothermessages.

WhatkindofattributedoIneed?Whatis"healthier" for the system, files saved in the database or files saved in a reserved directory?

I do not want the whole controller code ready, I need indications only, what kind of attribute to use, precautions, cleanest way to do this, that kind of help.

Information.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; }


    }
    
asked by anonymous 07.01.2016 / 17:38

1 answer

2
  

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

Use Backload . It works with most of the JS multiple upload plugins available. It has NuGet package . It's freemium: it does not pay anything to use, but the best functions are paid.

  

What is healthier for the system, files saved in the database or files saved in a reserved directory?

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

  

I do not want the whole controller code ready, I need indications only, what kind of attribute to use, precautions, cleanest way to do this, that kind of help.

A good JS plugin for this is the jQuery-File-Upload . It has NuGet package . Integrates easily with Backload. A demonstration 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 named InformacaoAnexo , and establish cardinality from N to 1 with Informacao .

    
07.01.2016 / 17:47