PDA

View Full Version : HTTP.Download function - Updated...



Intrigued
06-04-2005, 06:33 PM
I think this was removed (post) before because I was trying to help by linking to a executable (.exe) on my Website. I understand, that bot thing again I recon.

Here is the updated function with a dummied URL in the function call.


--[[
Here is a function that gets and returns (in a Dialog.Message()) the file size.
Make sure you use double quotes ("") when typing in the strFile argument!
]]
function fnGetFileSize(strFile)
nFileSize = HTTP.GetFileSize(strFile, MODE_BINARY, 5, 80, nil, nil, nil)
err = Application.GetLastError()
if err ~= 0 then
Dialog.Message("Error during download!", _tblErrorMessages[err])
Application.ExitScript()
else
nFileSize = String.GetFormattedSize(nFileSize, FMTSIZE_AUTOMATIC, true)
Dialog.Message("The file's size is...", nFileSize)
end
end

-- Then call (use) the function, like this example. (change the argument to the file path needed! - the argument is what's between the parenthesis '()')
fnGetFileSize("http://www.yourwebsitehere.com/afile")

Corey
06-04-2005, 06:40 PM
Hi. Your post wasn't removed, it was just moved to the AMS examples forum... :yes

Intrigued
06-04-2005, 06:41 PM
Oh! Can you remove this one then Corey, I must have missed that, sorry!

:huh