downloader

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var File = router.Handler(func(c router.Context) {
	filename := c.Param("filename")
	filePath := path.Join(config2.Upload.Path, config2.Upload.File.Path, filename)
	if !fs.PathExists(filePath) {

		http.NotFound(c.Writer(), c.Request())
		return
	}

	c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%v", filename))

	http.ServeFile(c.Writer(), c.Request(), filePath)
})
View Source
var Image = router.Handler(func(c router.Context) {
	filename := c.Param("filename")
	originImagePath := path.Join(config2.Upload.Path, config2.Upload.Image.Path, filename)
	if !fs.PathExists(originImagePath) {

		http.NotFound(c.Writer(), c.Request())
		return
	}
	c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%v", filename))
	http.ServeFile(c.Writer(), c.Request(), originImagePath)
})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL