Get file size
Posted on 2003-10-24
I'm sending binary files from a server to clients using sockets (much like simple ftp srv). I'd like the clients to show progressbar of the current download.
Because of this, I'd like the server to send file details (size most importantly) to the client before sending the binary. How do I get the details and send? I know about filesize(..), but it seams strange having to open and close the file before sending, just to have it opened again by the steam?
if FileExists (strFile) then
// Find and send file details before sending file...
Socket.SendStream (TFileStream.Create (
strFile, fmOpenRead or fmShareDenyWrite));
Any good ideas?