GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / SetHttpTransferBufferSize Method
The new value for the packet size for FTP or HTTP transfer, for example 1024, 2048, 4096, 8192 etc.
Example





In This Topic
SetHttpTransferBufferSize Method (GdPictureImaging)
In This Topic
Changes the packet size used for transferring data when creating the image from HTTP and FTP or when uploading the file to the FTP server. The initial value is 4096.
Syntax
'Declaration
 
Public Sub SetHttpTransferBufferSize( _
   ByVal Buffersize As Integer _
) 
public void SetHttpTransferBufferSize( 
   int Buffersize
)
public procedure SetHttpTransferBufferSize( 
    Buffersize: Integer
); 
public function SetHttpTransferBufferSize( 
   Buffersize : int
);
public: void SetHttpTransferBufferSize( 
   int Buffersize
) 
public:
void SetHttpTransferBufferSize( 
   int Buffersize
) 

Parameters

Buffersize
The new value for the packet size for FTP or HTTP transfer, for example 1024, 2048, 4096, 8192 etc.
Example
Setting up the packet size for FTP or HTTP transfer.
Uploading an image to a file located on a distant server using FTP transfer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Set the transferring options.
    gdpictureImaging.SetFtpPassiveMode(true);
    gdpictureImaging.SetHttpTransferBufferSize(2048);
    if (gdpictureImaging.UploadFileToFTP(@"D:\images\image.jpg", "ftp.com", "/demo/image.jpg", "user", "password", 21) != GdPictureStatus.OK)
    {
        MessageBox.Show("Uploading failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
                        "Uploading using FTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}
Saving an image to a file located on a distant server using HTTP transfer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
 
    // Set the packet size.
    gdpictureImaging.SetHttpTransferBufferSize(2048);
 
    if (gdpictureImaging.SaveToHTTP(imageID, GdPicture14.DocumentFormat.DocumentFormatJPEG, 75, "http://www.google.com/uploads/myimage.jpg") != GdPictureStatus.OK)
    {
        MessageBox.Show("Saving failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
                        "Saving to HTTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
 
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also