Waiting for engine...
Skip to main content

Uploading HTML5/HTML4/Java Tool and SOAP API using the short Key

Upload tool that uses short key is available through the following URL:

https://thruservername/ExternalJavaUpload.aspx?ShortId=<shortIdValue>

Where shortIDValue is prepared in advance by the web service call

String GetUploaderRequestKey(Guid sessionId, FTHUploaderRequest request)

Which will be specified below and represents the following data structure:

FTHUploaderRequest
{
public Guid SessionId,
public int FolderId,
public string SuccessUrl,
public string ErrorReportingUrl,
public string FileFilter,
public string FileFilterExceptions
}

Structure fields:

  • SessionId: Identifier of the current session used for file upload.
  • FolderId: ID of a folder in MFT FS file system obtained by previous web service calls. Files will be uploaded to this folder.
  • SuccessUrl: Redirect browser window containing HTML upload code or Java upload applet to this URL if upload is successful. Page should be provided by the web application calling MFT FS API
  • ErrorReportingUrl: Redirect browser window containing HTML upload code or Java upload applet to this URL if upload failed.

Page should be provided by the web application calling MFT FS API.

If upload failed, a server returns server error code using parameter “ThruErrorCode”.

If an error occurred and ErrorReportingUrl is not defined, then server throws unhandled exception in the upload page.

Error code is passed to error reporting page through ThruErrorCode URL parameter: ErrorReportingUrl?ThruErrorCode=<errorCode>

note

The value of ErrorReportingUrl is not validated. Ensure this is a valid URL.

  • FileFilter: specifies which file types can be uploaded through Java applet

Format: <Description> : <extension1>, <extension2> … <extensionN>.

For example: FileFilter=“Zip files (*.zip, *.7z, *.tar): zip, 7z, tar” will allow upload of files with zip, 7z, tar extensions.

Browsing in Add button is allowed only to the files of specified type. Drag and drop for all other file types is ignored.

If parameter is not specified, all file types can be uploaded.

  • FileFilterExceptions (optional): specifies which file types cannot be uploaded through Java applet. Format: 

<extension1>, <extensionX>.

For example: FileFilterExceptions=exe,msi,mp3 prevents uploading of the file types exe, msi, mp3.

note

Parameters FileFilter and FileFilterExceptions are mutually exclusive, only one can be used on java upload URL.

If the same file extension is specified in FileFilter and FileFilterExceptions, the latter overrides the former.

Server error codes

The codes below are passed as a ThruErrorCode URL parameter to ErrorReportingUrl in case any error occurs as ErrorReportingUrl?ThruErrorCode=<errorCode>

  • Unknown error, information is not available.

  • SessionId is not a valid Guid variable.

  • FolderId is not a valid integer variable

  • Unknown SessionId. Supplied session identifier does not exist on the server

  • Folder with specified ID does not exist on the server.

  • Upload failed. This is generic error code returned for any unknown error in upload. Check event log on the server running MFT FS server software.

Sample File Upload API URL with short key

[https://test.thruinc.net/ExternalJavaUpload.aspx?ShortId=NKBJH4TMDJBK1P2W1Y9O](https://test.thruinc.net/ExternalJavaUpload.aspx?ShortId=NKBJH4TMDJBK1P2W1Y9O)

Sample steps to work with File Upload API URL with short key: WDSL file for API version 4.0 is located at https://<servername>/ws4/fthservice.asmx?WSDL

  1. Get session id: 

    Open() or OpenImmutable() or other Open* calls in MFT FS API.

  2. Get FolderID for target upload folder by using one of the file browsing or search methods.

  3. Provide SuccessUrl, ErrorReportingUrl, FileFilter or FileFilterExceptions and fill in the structure 

FTHUploaderRequest

  1. Generate short key 
ShortIdValue= GetUploaderRequestKey(Guid sessionId, FTHUploaderRequest request)
  1. Compose View URL and open browser window with the link: 

https://<serverName>/ExternalJavaUpload.aspx?ShortId=<ShortIdValue>

Reference: Data structure to create ShortID for Upload

FTHUploaderRequest

Data TypeField NameSample ValueComments
GuidSessionId189BA074-F668-49CC-B7F6-330F4F89D755identifier of the current session used for file upload
intFolderId6Target FolderId. Files will be uploaded to this folder.
stringFileFilterZip files (*.zip, *.7z, *.tar): zip, 7z, tarstring for file filtering used in file open dialog. Defines allowed types.
String format: <Description> : <extension1>, <extension2> … <extensionN>.
If parameter is not passed all files are displayed.
StringFileFilterExceptionsexe, com, batstring for file filtering used in file open dialog. Defines restricted types. String format: <extension1>, <extenstion2>…<extensionN>. Can be used with FileFilter or standalone. In case used with FileFilter, result filter will contain only allowed types not included in the FileFilterExceptions
stringSuccessUrlhttp://success.comUpload API page redirects to this URL if upload succeeded
StringErrorReportingUrlhttp://error.comUpload API page redirects to this URL if upload failed

Sample

<uploaderRequest><SessionId>310105b2-5d9c-437b-bbdc-be6651992ffb</SessionId><FolderId>6</FolderId><SuccessUrl>http://success.com</SuccessUrl><ErrorReportingUrl>http://error.com</ErrorReportingUrl><FileFilter>Zip files (*.zip, *.7z, *.tar): zip, 7z, tar</FileFilter><FileFilterExceptions>exe, com, bat</FileFilterExceptions></uploaderRequest>`

Data Transfer Object

public class FTHUploaderRequest
{
public Guid SessionId { get; set; }
public int FolderId { get; set; }
public string SuccessUrl { get; set; }
public string ErrorReportingUrl { get; set; }
public string FileFilter { get; set; }
public string FileFilterExceptions { get; set; }
}

Reference: Method GetUploaderRequestKey

MethodString GetUploaderRequestKey (Guid SessionId, FTHUploaderRequest request)
DescriptionThe call accepts FTHUploaderRequest object and returns shortID.
Request BodyFTHUploaderRequest object
Return Data Objectstring
Invocation Scenario(s)
Remarks