Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: Downloading Tif File Webasp leave function before download is complete
Irfan

From: washington, DC USA
Posts: 2
Member Since: 04/25/05
posted April 25, 2005 1:32 PM

I am having little trouble working with PowerTCP the way I want. I am downloading a TIF file from a webserver with following fuction.

 

Private Function DownloadFile(ByRef sLocation As String) As Boolean

On Error GoTo ServerError

  

  Dim LocalFile As String

  

  WebASP1.Request.Content = ""

  WebASP1.Request.Url = sLocation

  WebASP1.ProxyType = ptNone

  WebASP1.ProxyPort = 0

  WebASP1.ProxyHost = ""

  WebASP1.ProxyUsername = ""

  WebASP1.ProxyPassword = ""

  WebASP1.Request.KeepAlive = KeepAlive

  WebASP1.Timeout = Timeout * 1000

  WebASP1.Security = 0

  

  LocalFile = App.path & "\temp\" & DocumentID & ".tif"

  

  

  prgProgress.Visible = True

  lblStatus.Caption = "Please wait downloading File..."

  

  WebASP1.Get

  

  WebASP1.Response.Body.FileMode = createAlways

  WebASP1.Response.Body.FileName = LocalFile

  

    

  

  DownloadFile = True

Exit Function

ServerError:

  MsgBox Err.Description & vbCrLf & "Function:DownloadFile", vbCritical, "DMS Scan/QA"

  DownloadFile = False

End Function

 

The function is called like this

 

If (DownloadFile(DocumentWebPath)) Then

      

    lblStatus.Caption = "File Transfer Complete. Click button below to open the file."

    GetFileSize(LocalFile)

Else

    MsgBox "Unable to download the Document to Local machine. Please Try again."

    End

End If

 

The file is downloaded fine but the download function returns TRUE before the file is completely downloaded on local machine so it cause a fire of GetFileSize event before file is completely downloaded and get wrong information.

 

Is there a way that DownloadFile function does not return TRUE until the download is complete?

I would really appreciate a quick response.

thanks
Irfan
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 25, 2005 1:44 PM

What is the value of "Timeout" when you run this test? If it's 0 then that is the problem. Try setting it to a positive value and see what happens:

WebASP1.Timeout = 30000

Irfan

From: washington, DC USA
Posts: 2
Member Since: 04/25/05
posted April 26, 2005 10:14 AM

thanks it worked i had timeout * 1000 but value of varablbe was 0 so it was set to 0.

thanks for your help
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX