Jump to content


Photo

How to resume upload on a large file using SFTP?


  • Please log in to reply
3 replies to this topic

#1 ds1

ds1
  • Members
  • 15 posts

Posted 08 February 2011 - 09:28 PM

We are using SmartFTP Library Version 2.0.107.0. We are trying to resume upload of file of size 8GB using SFTP over SSH connection. The code we are using is as follows:

_objSFTP.UploadFile(fileName, fileName, LocalfileLowValue, 0, ServerfileLowValue, 0) = sfFTPLib.enumError.ftpErrorSuccess

The problem is when the start byte of the file is a large value. The function "UploadFile" accepts only integer values for low and high and if the size of the start byte is in GB then we cant use an integer. Can anyone tell me how I can resume uploading of a large file over an SFTP connection?

#2 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 08 February 2011 - 09:33 PM

Split up your 64-bit integer into a lower and higher 32-bit part. Then pass it to the function.

Dim value As System.UInt64
value = 342342323423432;
Dim hi As System.UInt32
hi = System.Convert.ToUInt32(value >> 32)
Dim lo As System.UInt32
lo = System.Convert.ToUInt32(value)

UploadFile(file1, file2, lo, hi, lo, hi)

file1 != file2

#3 ds1

ds1
  • Members
  • 15 posts

Posted 10 February 2011 - 09:54 PM

I have tried the solution you gave for the problem but still I am still getting the same error. The exact size of file which I want to upload is 9127565312 bytes and I am resuming upload from 2548465664 bytes so the code is:

Dim value As System.UInt64
value = 2548465664;
Dim hi As System.UInt32
hi = System.Convert.ToUInt32(value >> 32)
Dim lo As System.UInt32
lo = System.Convert.ToUInt32(value)

However when we are calling the function as:

UploadFile(file1, file2, lo, hi, lo, hi)

The line gives the error "Arithmetic operation resulted in an overflow"

#4 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 10 February 2011 - 10:54 PM

Please install the latest build: http://www.smartftp....ftplib/download

Then use the new UploadFileEx() function:

Dim startPosition As System.UInt64
startPosition = 2548465664;
UploadFileEx(file1, file2, startPosition)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users