Beispiel #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="FileUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public FileUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
        {
            _location = Settings.Parameters["location"];

            if (_location == null)
            {
                // TODO: fix up
                throw new Exception("location must be specified for SlickUpload file provider");
            }
            else if (!Path.IsPathRooted(_location))
            {
                _location = HostingEnvironment.MapPath(_location);
            }

            string existingActionString = Settings.Parameters["existingAction"];

            if (!string.IsNullOrEmpty(existingActionString))
            {
                _existingAction = (ExistingAction)Enum.Parse(typeof(ExistingAction), existingActionString, true);
            }
            else
            {
                _existingAction = ExistingAction.Exception;
            }

            string fileNameMethodString = Settings.Parameters["fileNameMethod"];

            if (!string.IsNullOrEmpty(fileNameMethodString))
            {
                _fileNameMethod = (FileNameMethod)Enum.Parse(typeof(FileNameMethod), fileNameMethodString, true);
            }
            else
            {
                _fileNameMethod = FileNameMethod.Client;
            }

            _erroredLocation = Settings.Parameters["erroredLocation"];

            if (!string.IsNullOrEmpty(_erroredLocation) && !Path.IsPathRooted(_erroredLocation))
            {
                _location = HostingEnvironment.MapPath(_erroredLocation);
            }
        }
        /// <summary>
        /// Creates a new instance of the <see cref="FileUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public FileUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{
			_location = Settings.Parameters["location"];

			if (_location == null)
			{
				// TODO: fix up
				throw new Exception("location must be specified for SlickUpload file provider");
			}
			else if (!Path.IsPathRooted(_location))
			{
				_location = HostingEnvironment.MapPath(_location);
			}

			string existingActionString = Settings.Parameters["existingAction"];

			if (!string.IsNullOrEmpty(existingActionString))
				_existingAction = (ExistingAction)Enum.Parse(typeof(ExistingAction), existingActionString, true);
			else
				_existingAction = ExistingAction.Exception;

            string fileNameMethodString = Settings.Parameters["fileNameMethod"];

            if (!string.IsNullOrEmpty(fileNameMethodString))
                _fileNameMethod = (FileNameMethod)Enum.Parse(typeof(FileNameMethod), fileNameMethodString, true);
            else
                _fileNameMethod = FileNameMethod.Client;

            _erroredLocation = Settings.Parameters["erroredLocation"];

            if (!string.IsNullOrEmpty(_erroredLocation) && !Path.IsPathRooted(_erroredLocation))
                _location = HostingEnvironment.MapPath(_erroredLocation);
		}