AcceptFile Event

Fired when the client receives a file.


ANSI (Cross Platform)
virtual int FireAcceptFile(OFTPClientAcceptFileEventParams *e);
typedef struct {
const char *VirtualFileName;
const char *VirtualFileDate;
const char *Destination;
const char *Originator;
int Accept;
char *Filename;
int Overwrite;
int ErrorCode;
char *ErrorDescription; int reserved; } OFTPClientAcceptFileEventParams; Unicode (Windows) virtual INT FireAcceptFile(OFTPClientAcceptFileEventParams *e);
typedef struct {
LPCWSTR VirtualFileName;
LPCWSTR VirtualFileDate;
LPCWSTR Destination;
LPCWSTR Originator;
BOOL Accept;
LPWSTR Filename;
BOOL Overwrite;
INT ErrorCode;
LPWSTR ErrorDescription; INT reserved; } OFTPClientAcceptFileEventParams;
- (void)onAcceptFile:(NSString*)virtualFileName :(NSString*)virtualFileDate :(NSString*)destination :(NSString*)originator :(int*)accept :(NSString**)filename :(int*)overwrite :(int*)errorCode :(NSString**)errorDescription;

virtual INT IPWORKSEDI_CALL FireAcceptFile(LPSTR &lpszVirtualFileName, LPSTR &lpszVirtualFileDate, LPSTR &lpszDestination, LPSTR &lpszOriginator, BOOL &bAccept, LPSTR &lpszFilename, BOOL &bOverwrite, INT &iErrorCode, LPSTR &lpszErrorDescription);


This event controls the behavior when the client receives a file.

VirtualFileName holds the name of the file being received.

VirtualFileDate holds the date associated with the file in the format specified by VirtualFileDateFormat. The default value is "MM/dd/yyyy HH:mm:ss".

Destination identifies the receiver (SFID) code in the send file request. If the file was intended for this server this will match the value in ServerSFIDCode

Originator identifies the sender (SFID) code in the send file request.

Accept is true by default, and must be set to False in order to reject the file.

Filename will be populated with the full path and filename that will be written. It may be changed within this event to specify a new location. The Filename is determined by combining the path specified in OFTPConnectionDownloadDirectory and the name received from the client.

Overwrite is false by default, but may be set to true to overwrite existing files on disk.

ErrorCode controls the error returned to the client when Accept is set to False. If this is not set the class will use a value of 99 to indicate a general error.

ErrorDescription may also be set to include an error message. If this is not set the class will automatically include an error message based on the ErrorCode specified. Common error codes and their corresponding error messages are listed below.

ErrorCode ErrorMessage
1 Invalid filename.
2 Invalid destination.
3 Invalid origin.
4 Storage record format not supported.
5 Maximum record length not supported.
6 File size is too big.
10 Invalid record count.
11 Invalid byte count.
12 Access method failure.
13 Duplicate file.
14 File direction refused.
15 Cipher suite not supported.
16 Encrypted file not allowed.
17 Unencrypted file not allowed.
18 Compression not allowed.
19 Signed file not allowed.
20 Unsigned file not allowed.
99 Unspecified reason.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 C++ Edition - Version 20.0 [Build 8203]