コード例 #1
0
        public IFileUpload CreateFileUpload(IHttpRequest request, string name, string fileName,
                                            string contentType, string contentTransferEncoding, Encoding encoding,
                                            long size)
        {
            if (this.useDisk)
            {
                var fileUpload = new DiskFileUpload(name, fileName, contentType,
                                                    contentTransferEncoding, encoding, size);
                fileUpload.MaxSize = this.maxSize;
                CheckHttpDataSize(fileUpload);
                List <IHttpData> list = this.GetList(request);
                list.Add(fileUpload);
                return(fileUpload);
            }
            if (this.checkSize)
            {
                var fileUpload = new MixedFileUpload(name, fileName, contentType,
                                                     contentTransferEncoding, encoding, size, this.minSize);
                fileUpload.MaxSize = this.maxSize;
                CheckHttpDataSize(fileUpload);
                List <IHttpData> list = this.GetList(request);
                list.Add(fileUpload);
                return(fileUpload);
            }
            var memoryFileUpload = new MemoryFileUpload(name, fileName, contentType,
                                                        contentTransferEncoding, encoding, size);

            memoryFileUpload.MaxSize = this.maxSize;
            CheckHttpDataSize(memoryFileUpload);
            return(memoryFileUpload);
        }
コード例 #2
0
        public IFileUpload CreateFileUpload(IHttpRequest request, string name, string fileName,
                                            string contentType, string contentTransferEncoding, Encoding encoding,
                                            long size)
        {
            if (_useDisk)
            {
                var fileUpload = new DiskFileUpload(name, fileName, contentType,
                                                    contentTransferEncoding, encoding, size, _baseDir, _deleteOnExit)
                {
                    MaxSize = _maxSize
                };
                CheckHttpDataSize(fileUpload);
                List <IHttpData> list = GetList(request);
                list.Add(fileUpload);
                return(fileUpload);
            }
            if (_checkSize)
            {
                var fileUpload = new MixedFileUpload(name, fileName, contentType,
                                                     contentTransferEncoding, encoding, size, _minSize, _baseDir, _deleteOnExit)
                {
                    MaxSize = _maxSize
                };
                CheckHttpDataSize(fileUpload);
                List <IHttpData> list = GetList(request);
                list.Add(fileUpload);
                return(fileUpload);
            }
            var memoryFileUpload = new MemoryFileUpload(name, fileName, contentType,
                                                        contentTransferEncoding, encoding, size)
            {
                MaxSize = _maxSize
            };

            CheckHttpDataSize(memoryFileUpload);
            return(memoryFileUpload);
        }