@@ -547,10 +547,32 @@ public ServiceResponse upload(ServiceRequest request) throws Exception {
547547 //**************************************************************************
548548 //** upload
549549 //**************************************************************************
550- /** Used to upload files to the server
550+ /** Used to upload files to the server. The ServiceRequest must contain
551+ * "multipart/form-data" encoded data. The form data must includes a "path"
552+ * variable and at least one file.
551553 * @param request ServiceRequest with "multipart/form-data" encoded data
552554 * @param callback Optional callback. Called after a file has been uploaded.
553- * The callback record will contain the "file", "path", and "op".
555+ * If the request payload contains multiple files, the callback will be
556+ * called multiple times - once for each file after it had been uploaded.
557+ * The callback record will contain the following fields:
558+ * <ul>
559+ * <li>file: A javaxt.io.File representing uploaded file on the server</li>
560+ * <li>path: String representing the relative or absolute path to the
561+ * upload directory</li>
562+ * <li>op: String representing the operation that was performed (e.g.
563+ * "create" or "update")</li>
564+ * </ul>
565+ * Example:
566+ <pre>
567+ fileService.upload(request, (Record record)->{
568+
569+ String path = record.get("path").toString();
570+ javaxt.io.File file = (javaxt.io.File) record.get("file").toObject();
571+ path += file.getName();
572+
573+ NotificationService.notify(record.get("op").toString(), "File", new javaxt.utils.Value(path));
574+ });
575+ </pre>
554576 */
555577 public ServiceResponse upload (ServiceRequest request , Callback callback ) throws Exception {
556578
0 commit comments