lweb/inc/lweb_helper.pbi

59 lines
1.4 KiB
Text
Raw Normal View History

;********************************
;*
;* lweb_helper.pbi
;*
Procedure.s mimetype(file.s)
Select file
2022-02-17 13:21:13 +01:00
Case "pdf"
ProcedureReturn "application/pdf"
Case "zip"
ProcedureReturn "application/zip"
2022-02-17 15:30:17 +01:00
Case "gz"
ProcedureReturn "application/gzip"
2022-02-17 13:21:13 +01:00
Case "doc"
ProcedureReturn "application/msword"
Case "xls"
ProcedureReturn "application/vnd.ms-excel"
Case "ppt"
ProcedureReturn "application/vnd.ms-powerpoint"
Case "png"
ProcedureReturn "image/png"
Case "gif"
ProcedureReturn "image/gif"
Case "jpg"
ProcedureReturn "image/jpeg"
Case "jpeg"
ProcedureReturn "image/jpeg"
Case "txt"
ProcedureReturn "text/plain"
Case "html"
ProcedureReturn "text/html"
Case "htm"
ProcedureReturn "text/html"
Case "mss"
ProcedureReturn "text/html"
2022-02-17 13:21:13 +01:00
Case "php"
ProcedureReturn "text/html"
Case "css"
ProcedureReturn "text/css"
Case "js"
ProcedureReturn "text/javascript"
Default
2022-02-17 13:21:13 +01:00
ProcedureReturn "application/octet-stream"
EndSelect
EndProcedure
Procedure.s MapToJSONString(Map ConvertMap.s())
Protected MyJSON
Protected.s Response
MyJSON = CreateJSON(#PB_Any)
If MyJSON
InsertJSONMap(JSONValue(MyJSON), ConvertMap())
Response = ComposeJSON(MyJSON)
FreeJSON(MyJSON)
ProcedureReturn Response
EndIf
ProcedureReturn #error_string
EndProcedure