{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2026-09-30T09:18:25Z","object_id":{"id":2241,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_fileuploader","title":"mod_fileuploader","uri":"https:\/\/zotonic.com\/id\/2241"},"seq":1}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"subject":{"objects":[{"created":"2026-09-30T09:18:25Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2580,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_file_uploads","title":"File uploads","uri":"https:\/\/zotonic.com\/id\/2580"},"seq":3},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2598,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_messaging_and_pubsub","title":"Messaging and publish-subscribe","uri":"https:\/\/zotonic.com\/id\/2598"},"seq":4},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2625,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_model","title":"Model","uri":"https:\/\/zotonic.com\/id\/2625"},"seq":5},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2645,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_upload","title":"Upload","uri":"https:\/\/zotonic.com\/id\/2645"},"seq":6},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2673,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_javascript","title":"JavaScript","uri":"https:\/\/zotonic.com\/id\/2673"},"seq":7},{"created":"2026-09-30T09:18:25Z","object_id":{"id":2718,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_cotonic","title":"Cotonic","uri":"https:\/\/zotonic.com\/id\/2718"},"seq":8}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2750,"is_a":["text","documentation","reference","cotonic_reference","cotonic_model"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2750"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_zotonic_cotonic_model_fileuploader","page_url":{"en":"https:\/\/zotonic.com\/cotonic\/zotonic-models\/fileuploader","x-default":"https:\/\/zotonic.com\/cotonic\/zotonic-models\/fileuploader"},"preview_url":null,"resource":{"version":21,"pivot_location_lat":null,"title":"model\/fileuploader","is_authoritative":true,"body":"<h1>model\/fileuploader<\/h1>\n<p>Queues browser files and uploads them in chunks through <code>mod_fileuploader<\/code>.\nThe <code>_fileuploader_worker.tpl<\/code> include starts the worker. It depends on\n<code>bridge\/origin<\/code> and advertises the capability <code>fileuploader<\/code> (without <code>model\/<\/code>).<\/p>\n<h2>post\/new<\/h2>\n<p>Topic: <code>model\/fileuploader\/post\/new<\/code>.<\/p>\n<table class=\"table\"><thead><tr><th>Payload field<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>files<\/code><\/td><td>Non-empty array of <code>{ name, file, upload }<\/code> objects. <code>file<\/code> is a browser <code>File<\/code>; <code>name<\/code> identifies the form field; <code>upload<\/code> optionally supplies the server upload name.<\/td><\/tr><tr><td><code>ready_topic<\/code>, <code>ready_msg<\/code><\/td><td>Destination and base payload for completion.<\/td><\/tr><tr><td><code>failure_topic<\/code>, <code>failure_msg<\/code><\/td><td>Destination and payload for failure.<\/td><\/tr><tr><td><code>progress_topic<\/code>, <code>progress_msg<\/code><\/td><td>Destination and base payload for progress updates.<\/td><\/tr><tr><td><code>start_topic<\/code><\/td><td>Optional destination for each file&#39;s upload state after server initialization.<\/td><\/tr><\/tbody><\/table>\n<pre class=\"notranslate\"><code class=\"notranslate language-javascript\">cotonic.broker.publish(&quot;model\/fileuploader\/post\/new&quot;, {\n    files: [{ name: &quot;document&quot;, file: fileInput.files[0] }],\n    ready_topic: &quot;my\/upload\/ready&quot;,\n    ready_msg: {},\n    failure_topic: &quot;my\/upload\/failed&quot;,\n    failure_msg: {},\n    progress_topic: &quot;my\/upload\/progress&quot;,\n    progress_msg: {}\n});\n<\/code><\/pre>\n<p>On normal completion, the worker adds a <code>fileuploader<\/code> array to <code>ready_msg<\/code>.\nEach entry is <code>{ name, upload }<\/code>, where <code>upload<\/code> is the server upload identifier.\nFor a Zotonic <code>postback_event<\/code>, it instead appends fileuploader references to the\npostback&#39;s query arguments. Progress payloads add <code>percentage<\/code>; failure publishes\nthe supplied failure payload.<\/p>\n<p>When the request has a response topic, it receives the initial queue request\nobject. This acknowledgement does not mean that uploading has finished. Use the\nconfigured completion and failure topics for the result. An empty file array\ndoes not create an upload request; a call instead receives the immediate error\npayload <code>{ status: &quot;error&quot;, error: &quot;No files&quot; }<\/code> on its response topic.<\/p>\n<p>The worker initializes files through\n<code>bridge\/origin\/model\/fileuploader\/post\/new<\/code>, then sends blocks to the returned\nHTTP upload URL. This browser model and the server fileuploader model have\ndifferent payload contracts.<\/p>\n<h2>post\/delete\/+name<\/h2>\n<p>Topic: <code>model\/fileuploader\/post\/delete\/+name<\/code>.<\/p>\n<p>Delete the upload identified by its server upload name. The worker removes its\nlocal upload state and requests deletion through the server model. The payload\nis ignored and the command does not reply.<\/p>\n<h2>post\/next<\/h2>\n<p>Topic: <code>model\/fileuploader\/post\/next<\/code>.<\/p>\n<p>Internal scheduling trigger used when a block finishes. Applications should\nsubmit files through <code>post\/new<\/code> rather than manage this scheduling topic.<\/p>\n<p>There is no fixed <code>model\/fileuploader\/event\/...<\/code> stream: callers choose the\nnotification topics in each upload request.<\/p>\n<h2>Implementation<\/h2>\n<p><a href=\"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_fileuploader\/priv\/lib\/js\/zotonic.fileuploader.worker.js\">JavaScript source<\/a>.<\/p>","slug":"model-fileuploader","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"6f1430ed8565b97aff40404cf4ddc4ce0ce8c4d1f364ec6aeec6c4a615183f5d","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":2723,"is_a":["meta","category"],"name":"cotonic_model","title":"Cotonic models","uri":"https:\/\/zotonic.com\/id\/cotonic_model"},"doc_source_path":"doc\/cotonic-models\/fileuploader.md","publication_start":"2026-09-30T09:18:25Z","page_path":"\/cotonic\/zotonic-models\/fileuploader","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/doc\/cotonic-models\/fileuploader.md","pivot_location_lng":null,"doc_source_kind":"cotonic_model","name":"doc_zotonic_cotonic_model_fileuploader","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-09-30T09:18:25Z","uri":null,"doc_status":"current","is_dependent":false,"publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"b8c4b2ccdc223257f311968fbd17b2d66f0c4156\n","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-09-30T09:40:08Z","title_slug":"model-fileuploader"},"uri":"https:\/\/zotonic.com\/id\/2750","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2750"}},"status":"ok"}