Commit decdd052 authored by Carsten  Rose's avatar Carsten Rose
Browse files

CODING.md: Rewrote upload doc. Needs some more info about _deleted_<FE_NAME>.

parent c56c9644
......@@ -109,37 +109,42 @@ Upload
-----------------
* The upload UI consist of three elements
* 1) A <div> tag with a) an optional filename of an earlier uploaded file and b) a trash Button.
* 1) A <div> tag with a) an optional filename of an earlier uploaded file and b) a trash button.
* 2) The 'browse' button (<input type='file' name='<feName>'>). This element will not be send by post.
* 3) A HTML hidden element with name=<feName> containing the <sipUpload>.
* A new uniq SIP (sipUpload) will be created for every upload formElement. These 'sipUpload' will be assigned to the upload browse button and to the upload delete button.
* The individual sipUpload is necessary to correctly handle multiple simultaenously forms when using r=0. Also, through this uniq id it's easy to distinguish between asynchron uploaded files.
* A new uniq SIP (sipUpload) will be created for every upload formElement. These 'sipUpload' will be assigned to the upload
browse button and to the upload delete button.
* The individual sipUpload is necessary to correctly handle multiple simultaenously forms when using r=0. Also, through
this uniq id it's easy to distinguish between asynchron uploaded files.
* The SIP on ther server contains the individual '_FILES' information submitted during the upload.
* Via the hidden element <feName> 'save()', access to the form individual upload status informations is given.
Upload to server, before 'save'
...............................
* If a user open's a file for upload via the browse button, that file is immediately transmitted to the server. The user will see a turning wheel until the upload finished.
* If a user open's a file for upload via the browse button, that file is immediately transmitted to the server. The user
will see a turning wheel until the upload finished.
* After successfull upload the 'Browse' button disappears and the filename, plus the delete button, will be displayed (client logic).
* The uploaded file will be checked: maxsize, mime type, check script.
* The uploaded file is still temporary. It has been renamed from $_SESSION['X'][<uploadSip>][FILES_TMP_NAME] to $_SESSION['X'][<uploadSip>][FILES_TMP_NAME].cached
* The uploaded file is still temporary. It has been renamed from '[STORE_EXTRA][<uploadSip>][FILES_TMP_NAME]' to
'[STORE_EXTRA][<uploadSip>][FILES_TMP_NAME].cached'.
* The upload action will be saved in the user session.
* $_SESSION['X'][<uploadSip>][FILES_TMP_NAME|FILES_NAME|FILES_ERROR|FILE_SIZE]
* [STORE_EXTRA][<uploadSip>][FILES_TMP_NAME|FILES_NAME|FILES_ERROR|FILE_SIZE]
* Clicks the user on delete button:
* In the usersession a flagDelete will be set: $_SESSION['X'][<uploadSip>]['flagDelete']='1'
* In the usersession a flagDelete will be set: [STORE_EXTRA][<uploadSip>]['flagDelete']='1'
* An optional previous upload file (still not saved on the final place) will be deleted.
* An optional existing variable $_SESSION['X'][<uploadSip>][FILES_TMP_NAME] will be deleted. The 'flagDelete' must not be change - it's later needed to detect to delete earlier uploaded files.
* An optional existing variable [STORE_EXTRA][<uploadSip>][FILES_TMP_NAME] will be deleted. The 'flagDelete' must not
be change - it's later needed to detect to delete earlier uploaded files.
Form save
.........
* Step 1: insert /update the record.
* Step 2: process all 'uploads'.
* Get every uniq sipUpload to every upload formElement. Get the corresponding temporary uploaded filename.
* If $_SESSION['X'][<uploadSip>]['flagDelete']='1' is set, delete prefious uploaded file.
* Get every uniq uploadSip (=[STORE_CLIENT][[<feName>]) of every upload formElement. Get the corresponding temporary uploaded filename.
* If [STORE_EXTRA][<uploadSip>]['flagDelete']='1' is set, delete previous uploaded file.
* Calculate <destination>
* mv <file>.cached <destination>
* clientvalue[<feName>] = <destination>
* delete $_SESSION['X'][<uploadSip>]
* delete [STORE_EXTRA][<uploadSip>]
* Step 3: update record with final `FileDestination'
Formelement type: DATE / DATETIME / TIME
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment