コード例 #1
0
        public async Task <IActionResult> OnPostUploadAsync()
        {
            using (memoryStream = new MemoryStream())
            {
                await FileUpload.FormFile.CopyToAsync(memoryStream);

                // Upload the file if less than 50 MB
                if (memoryStream.Length < 5068435456)
                {
                    var file = new AppFile()
                    {
                        Content = memoryStream.ToArray()
                    };

                    newAppFile = new AppFile();

                    _3DPS RequestDirector = new _3DPS();
                    bool  confirmation;
                    file.FileName  = FileUpload.FormFile.FileName;
                    file.FileType  = Path.GetExtension(FileUpload.FormFile.FileName);
                    file.ColorName = ColorSelect;
                    file.Comments  = Comments;
                    confirmation   = RequestDirector.UploadAppFile(file);

                    FileList = RequestDirector.GetAppFiles();
                }
                else
                {
                    ModelState.AddModelError("File", "The file is too large.");
                }
            }

            Message = "File successfully uploaded!";
            return(Page());
        }
コード例 #2
0
        public void OnGet()
        {
            _3DPS RequestDirector = new _3DPS();

            FileList        = RequestDirector.GetAppFiles();
            AvailableColors = RequestDirector.GetColors();
        }
コード例 #3
0
        public void OnPost()
        {
            _3DPS RequestDirector = new _3DPS();

            FileList = RequestDirector.GetAppFiles();
        }