Upload function:
function upload(file, title, user, pass) if not http then return false, "HTTP required" end if fs.isDir(file) then return false, "\"file\" is a directory" end if fs.exists(file) == false then return false, "\"file\" doesn't exist" end local userkey = "" if user and pass then local uresponse = http.post("https://www.pastebin.com/api/api_login.php", "api_dev_key=24eeeaa32fe9c4724e7e4f4f4c601f80&".. "api_user_name="..textutils.urlEncode(user).."&".. "api_user_password="..textutils.urlEncode(pass) ) if uresponse then if string.match(uresponse.readAll(), " ") == nil then userkey = uresponse.readAll() end uresponse.close() end end local hdata = fs.open(file, "r") local data = hdata.readAll() hdata.close() local presponse = http.post("https://www.pastebin.com/api/api_post.php", "api_option=paste&".. "api_dev_key=CENSORED&".. "api_paste_code="..data.."&".. "api_user_key="..userkey.."&".. "api_paste_name="..title and title or "".."&".. "api_paste_format=lua&".. "api_paste_expire_date=N&".. "api_paste_private=0" ) if presponse then local presponses = presponse.readAll() presponse.close() return string.sub(presponses, 21) end end