Tuesday, February 9, 2010

How to verify file downloaded properly in web scripts

There will be many occurrences where you need to validate whether the script is downloading proper file as part of the request (in web script) or not.

The simple way is to check the size of the download content, if that matches with the size of file then you can confirm that correct file is downloaded properly.

For this you can use the following function to check the download size:

web_get_int_property (HTTP_INFO_DOWNLOAD_SIZE);

PS: Place this request after you made call to your main request.

1 comment:

  1. I believe that cannot be conclusive. the download size property gives the size of the resultant page. Even if you are getting an error page, you might get some valid size.
    Dont you think this has to be clubbed with searching the header for the content type or the file name. That will help better...

    ReplyDelete