Exemple #1
0
        public FileSystemStorageProvider(FileSystemSettings settings)
        {
            var mediaPath = HostingEnvironment.IsHosted
                                ? HostingEnvironment.MapPath("~/Media/") ?? ""
                                : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");

            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";

            if (HostingEnvironment.IsHosted)
            {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
            {
                appPath = appPath + '/';
            }
            if (!appPath.StartsWith("/"))
            {
                appPath = '/' + appPath;
            }

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }
        public FileSystemStorageProvider(FileSystemSettings settings, IWebHelper webHelper)
        {
            var mediaPath = webHelper.MapPath("~/Media/");
            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";
            if (HostingEnvironment.IsHosted) {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
                appPath = appPath + '/';
            if (!appPath.StartsWith("/"))
                appPath = '/' + appPath;

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }
        public FileSystemStorageProvider(FileSystemSettings settings)
        {
            var mediaPath = HostingEnvironment.IsHosted
                                ? HostingEnvironment.MapPath("~/Media/") ?? ""
                                : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");

            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";
            if (HostingEnvironment.IsHosted) {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
                appPath = appPath + '/';
            if (!appPath.StartsWith("/"))
                appPath = '/' + appPath;

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }
        public FileSystemStorageProvider(FileSystemSettings settings, IWebHelper webHelper)
        {
            var mediaPath = webHelper.MapPath("~/Media/");

            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";

            if (HostingEnvironment.IsHosted)
            {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
            {
                appPath = appPath + '/';
            }
            if (!appPath.StartsWith("/"))
            {
                appPath = '/' + appPath;
            }

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }