example.txt
Hi!
My file example.txt is attached.
local Multipart = require("multipart")
local io = require("io")
local open = io.open
local function read_file(path)
local file = open(path, "r")
if not file then return nil end
local content = file:read "*a"
file:close()
return content
end
local body = read_file("example.txt");
local multipart_data = Multipart(body, "text/html")
local t = multipart_data:tostring()
print (t)
This code prints empty line. What's wrong? Please, explain it.
example.txt
Hi!
My file example.txt is attached.
This code prints empty line. What's wrong? Please, explain it.