Upload-Modul (EN)
General
The following describes how the Upload-module works and how an ERP system can fetch the Upload-files from the shop server via SFTP.
Upload products
In the shop, upload products are marked accordingly. For each upload product, a customer can upload one or more Upload-files after the order process.
Upload-ID / Position-ID
As soon as an upload product is placed in the shopping cart, the shop generates an Upload-ID once. This Upload-ID always remains the same during a session.
In addition, an Position-ID is generated for each upload product. If an upload product is subsequently deleted from the shopping cart, the associated Position-ID is also deleted.
For each Upload-ID and Position-ID, the shop synchronously creates upload directories with the same name, in which the upload files are stored by the Upload-module.
The directory structure is as follows:<upload root directory>
Upload-ID (Upload-ID of an order)
finished.sync (Finished-file)
upload.log (Log-file)
fileinfo.dat (Info-file)
Position-ID1 (Upload-ID of the 1st position)
Upload-file1
Upload-file2
...
Upload-fileN
Position-ID2 (Upload-ID of the 2nd position)
Upload-file1
Upload-file2
...
Upload-fileN
...
Position-IDN (Upload-ID of the N. position)
Upload-file1
Upload-file2
...
Upload-fileN
Transfer of the Upload-ID / Position-ID in the order data
The ERP system is informed of the Upload-ID and Position-ID within the purchase order.
Extract from the order data:
<Order>
...
UploadID = 5DA7106A
...
</Order>
<OrderList>
<Item>
Number = 1234
Name = Product 1
UploadID = A882F49D (Position)
...
</Item>
<Item>
Number = 1111
Name = Product 2
UploadID = A22445566 (Position)
...
</Item>
<Item>
Number = 567890
Name = Product 3
UploadID = A22445566 (Position)
...
</Item>
<OrderList>
Based on this information, the ERP system can pick up the Upload-files for each order specifically via SFTP.
Administration files
In addition to the Upload-files, there are 3 administration files directly below the upload directory. These are:
finished.sync (Completion-file)
upload.log (Log-file)
fileinfo.dat (Info-file)
File "finished.sync"
Since the orderer can upload multiple files, he has to inform the Upload-module when he has finished uploading all files. For this purpose, the Upload-module creates a completion file named "finished.sync" in the upload directory associated with the Upload-ID.
A single line with the date and time of completion is written to this file. The format is "YYYY/MM/DD<space>HH:MM"
Example:
2013/03/27 18:57
Please note:
An ERP system is not allowed to collect the Upload-files via SFTP until the finished.sync file exists, i.e. the orderer has completed the uploads. For this purpose, the ERP system must implement a polling procedure for the finished.sync file.
File "upload.log"
In addition, a log file named "upload.log" is written to the upload directory associated with the Upload-ID and the log data is displayed to the orderer. The file is saved in TSV format (tab as field separator) and contains the following fields:
The first line contains the column names.
Column name | Description |
---|---|
Date | Date in the format DD.MM.YYYY |
Time | Time in the format HH:MM |
Type | Description of the transaction e.g. "File uploaded". |
TechType | Technical, language independent description |
File | Name of the file |
The following "types" of actions are currently supported by the internal Upload-module:
Type | TechType |
---|---|
File deleted | delete |
Uploads completed | finished |
File uploaded | upload |
File already exists | uploaddupfile |
Unlocked (not used at the moment) | unlocked |
Maximum size per file exceeded | filelimit |
Maximum number of files per order item exceeded | poslimitcount |
Maximum size per order item exceeded | limitmb |
Incomplete data upload | uploaderror |
From the 2nd line on the data follows.
Example:Date Time Type TechType File Upload-ID Position-ID
12/19/2011 09:21 File upload upload front.pdf 0708D800 905B1908
12/19/2011 09:21 File delete delete front.pdf 0708D800 905B1908
19/12/2011 09:22 File upload upload front1.pdf 0708D800 905B1908
2011/12/19 09:22 File upload upload back1.pdf 0708D800 905B1908
2011/12/19 09:23 Uploads completed finished 0708D800 905B1908
File "fileinfo.dat"
The customer can select the content of the file via a select box for each Upload-file.
The file is saved in TSV format (Tab as field separator) and contains the following fields:
The 1st line contains the column names.
Column name | Description |
---|---|
File | Name of the Upload-file |
ID | Integer Value. Position of the entry in the select box, starting from 0. |
Type | Language dependent entry in the select box, e.g. |
PosID | Position-ID |
Starting from the 2nd line, the data follows.
Example:
File ID Type PosID
File1.pdf 0 Please select 696EE098
File2.pdf 1 All in one document 696EE098
Example directory after a completed upload:<upload root directory>
0708D800 (Upload-ID)
905B1908 (Position-ID)
Front1.pdf (Upload-file)
Back1.pdf (Upload-file)
finished.sync (Finishing-file)
upload.log (Log-file)
fileinfo.dat (Info-file)
Please note:
After the ERP system has fetched the Upload-files via SFTP, the complete upload directory must be deleted by the ERP system via SFTP command. In addition, WEBSALE AG will delete all upload directories older than 6 weeks (clean up function of directory "corpses").