Added tracking for uploading and downloading files
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"fitra-backend/utils"
|
||||
)
|
||||
|
||||
func HandleFileDownload(c *gin.Context) {
|
||||
@@ -23,6 +24,9 @@ func HandleFileDownload(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Send analytics event
|
||||
utils.SendAnalyticsEvent("file_download", "/api/download/"+fileID+"/"+filename, "File Download", c.GetHeader("User-Agent"), c.ClientIP())
|
||||
|
||||
c.Header("Content-Description", "File Transfer")
|
||||
c.Header("Content-Transfer-Encoding", "binary")
|
||||
c.Header("Content-Disposition", "attachment; filename="+filename)
|
||||
|
||||
Reference in New Issue
Block a user