{"id":4995,"date":"2021-12-20T19:20:14","date_gmt":"2021-12-20T11:20:14","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4995"},"modified":"2025-02-21T14:03:45","modified_gmt":"2025-02-21T06:03:45","slug":"file-share","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/react-native-toolkit\/file-share\/","title":{"rendered":"File Sharing: React Native SDK &#8211; Video API"},"content":{"rendered":"\n<p>The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file.<\/p>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#upload-file\">Upload File to Share<\/a><\/li><li><a href=\"#download-file\">Download Shared File<\/a><\/li><li><a href=\"#cancel-upload\">Cancel File Upload<\/a><\/li><li><a href=\"#cancel-file-download\">Cancel File Download<\/a><\/li><\/ul>\n\n\n\n<a name=\"upload-file\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Upload File to Share<\/h3>\n\n\n\n<p>The <code>Enx.sendFiles()<\/code> method is used to initiate a file transfer to Video Server. <\/p>\n\n\n\n<p><strong>Class:<\/strong><code> Enx<\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>Enx.sendFiles(isBroadcast,clientIdList)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code style=\"background-color: rgb(255, 255, 255);\">isBroadcast <\/code>\u2013 Boolean. Set it to <em>true<\/em> to share file(s) with all the participants in the Session and <em>false<\/em> to share file(s) with the intended user(s). <\/li><li><code>clientIdList<\/code> \u2013 List of Client IDs intended to receive the file(s). This parameter is not applicable if <code>isBroadcast<\/code> parameter is set to <em>true<\/em>.<\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Sender&#8217;s End:<\/strong>  <\/p>\n\n\n\n<ul><li><code>initFileUpload<\/code> &#8211; Notification to the sender when the file upload process is initiated.<\/li><li><code>fileUploaded<\/code> &#8211; Notification to the sender when the file has been uploaded.<\/li><li><code>fileUploadFailed<\/code> &#8211; Notification to the sender when the file upload process fails.<\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Receiver&#8217;s End:<\/strong>  <\/p>\n\n\n\n<ul><li><code>fileUploadStarted <\/code>&#8211; Notification to the intended receiver when a file is being uploaded.<\/li><li><code>fileAvailable <\/code>&#8211; Notification to the intended receiver when a file is ready to download.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.sendFiles(isBroadcast,clientIdList)\n\ninitFileUpload:event=&gt;{\n\/\/ To sender - File upload process started\n}\n\nfileUploaded:event=&gt;{\n\/\/ To sender - File upload is complete\n}\n\nfileUploadFailed:event=&gt;{\n\/\/ To sender - File upload has failed\n}\n\nfileUploadStarted:event=&gt;{\n\/\/ To intended receiver - A new file upload started\n}\n\nfileAvailable:event=&gt;{\n\/\/ To intended receiver - A file is available for download\n}<\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<a name=\"download-file\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Download Shared File<\/h3>\n\n\n\n<p>The process of downloading shared file(s) comprises two steps:<\/p>\n\n\n\n<ul><li>Know file(s) available for download.<\/li><li>Initiate download on the available file(s).<\/li><\/ul>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Know files available for download<\/h4>\n\n\n\n<p>The<strong> <code>Enx.getAvailableFiles()<\/code> <\/strong>method returns a JSON Object with all the files available for download.<\/p>\n\n\n\n<p><strong>Class:<\/strong> Enx <\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>Enx.getAvailableFiles()<\/code><\/p>\n\n\n\n<p><strong>Callback<\/strong>:<b> <code>fileAvailable<\/code><\/b> &#8211; The intended receiver is notified when a file is available for download.  <\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.getAvailableFiles()\n\nfileAvailable:event=&gt;{\n\n\/\/ To intended receiver - A file is available for download\n}<\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Initiate File Download <\/h4>\n\n\n\n<p>The <code>Enx.downloadFile()<\/code> method is used to initiate the file download using the file information received above. <\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>Enx<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>Enx.downloadFile(fileInfo,isAutoSave)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>fileInfo<\/code>\u2013 File JSON Object available for download.<\/li><li><code>isAutoSave<\/code> \u2013 Boolean. Set it to <em>true<\/em> to save the file automatically in which case you receive the saved file&#8217;s path. When set to <em>false<\/em>, you receive Base64 encoded RAW data to handle the file saving process manually. <\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Receiver&#8217;s End:<\/strong><\/p>\n\n\n\n<ul><li><code>fileDownloaded<\/code> &#8211; Notification sent when the file has been downloaded with or without auto-saving.<\/li><li><code>fileDownloadFailed<\/code> &#8211; Notification sent when download fails.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.downloadFile(fileInfo,isAutoSave)\n\nfileDownloaded:event=&gt;{\n\/\/ To receiver - File has been downloaded\n}\n\nfileDownloadFailed:event=&gt;{\n\/\/ To receiver - File download has failed\n}<\/pre>\n\n\n\n<a name=\"cancel-upload\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel File Upload<\/h3>\n\n\n\n<p>The <code>Enx.cancelUpload()<\/code> method allows you to cancel an ongoing file upload job initiated by you.<\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>Enx<\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>Enx.cancelUpload(upJobId)<\/code><\/p>\n\n\n\n<p><strong>Parameter:<\/strong><\/p>\n\n\n\n<p><code>upJobId<\/code> &#8211; Numeric. The Id of the file upload job. <\/p>\n\n\n\n<p><strong>Callback: <\/strong><code>fileUploadCancelled<\/code> &#8211; Acknowledgment to the user when the file upload is cancelled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.cancelUpload(upJobId)\n\nfileUploadCancelled:event=&gt;{\n\/\/ Acknowledgment to the user when the file upload is cancelled.\n}<\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The <code>Enx.cancelAllUploads()<\/code> method allows you to cancel all ongoing file uploads initiated by you.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>Enx.cancelAllUploads()<\/code> &#8211; No Parameter required. <\/p>\n\n\n\n<p><strong>Callback: <\/strong><code>fileUploadCancelled<\/code> &#8211; Acknowledgment to the user when the file upload is cancelled. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.cancelAllUploads()\n\nfileUploadCancelled:event=&gt;{\n\/\/ Acknowledgment to the user when the file upload is cancelled.\n}<\/pre>\n\n\n\n<p><strong>Error Codes \/ Exceptions:<\/strong> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>5089<\/td><td>Storage Access denied.<\/td><\/tr><tr><td>5090<\/td><td>Failed to save file.<\/td><\/tr><tr><td>5091<\/td><td>File-Sharing not available in this context.<\/td><\/tr><tr><td>5092<\/td><td>Too many files to upload. Max 1 file allowed per request.<\/td><\/tr><tr><td>1185<\/td><td>File size exceeds the max allowed size. <\/td><\/tr><tr><td>1182<\/td><td>Failed to upload file.<\/td><\/tr><tr><td>5098<\/td><td>Unable to cancel file upload after file upload complete. <\/td><\/tr><tr><td>5099<\/td><td>Failed to cancel upload as invalid Upload ID passed as a parameter.<\/td><\/tr><tr><td>5100<\/td><td>Failed to upload a possibly corrupt file. <\/td><\/tr><tr><td>5102<\/td><td>Cancel upload not available without Web View. Non-Contextual Method Call.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"cancel-file-download\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel File Download<\/h3>\n\n\n\n<p>The <code>Enx.cancelDownload()<\/code> allows you to cancel the ongoing file download job taking place at your endpoint. <\/p>\n\n\n\n<p><strong>Class:<\/strong> Enx<\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>Enx.cancelDownload(JobId)<\/code><\/p>\n\n\n\n<p><strong>Parameter: <\/strong><code>upJobId<\/code> &#8211; Numeric. The Id of the file download job.<\/p>\n\n\n\n<p><strong>Callback: <\/strong><code>fileDownloadCancelled<\/code> &#8211; Acknowledgment to the user when the file download is cancelled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.cancelDownload(JobId)\nfileDownloadCancelled:event=&gt;{\n\/\/ Acknowledgment to the user when the file download is cancelled.\n}<\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The <code>Enx.cancelAllDownloads()<\/code> method allows you to cancel all ongoing file downloads taking place at your endpoint.<\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>Enx.cancelAllDownloads()<\/code> &#8211; No Parameter required.<\/p>\n\n\n\n<p><strong>Callback: <\/strong><code>fileDownloadCancelled<\/code> &#8211; Acknowledgment to the user when the file download is cancelled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.cancelAllDownloads()\nfileDownloadCancelled:event=&gt;{\n\/\/ Acknowledgment to the user when the file download is cancelled.\n}<\/pre>\n\n\n\n<p><strong>Error Codes \/ Exceptions:<\/strong> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>5089<\/td><td>Storage Access denied.<\/td><\/tr><tr><td>5090<\/td><td>Failed to save file.<\/td><\/tr><tr><td>1183<\/td><td>Failed to download file.<\/td><\/tr><tr><td>1181<\/td><td>File Download not available. Non-contextual Method Call.<\/td><\/tr><tr><td>5101<\/td><td>File already downloaded.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>\u2190 <a href=\"..\/custom-signalling\/\">Custom Signalling<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-center\"><a href=\"..\/\">Index<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-right\"><a href=\"..\/screen-share\/\">Screen Share<\/a> \u2192<a href=\"\/developer\/how-to-use\/\"><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file. Table of Contents Upload File to Share Download Shared File Cancel File Upload Cancel File Download Upload File to Share The Enx.sendFiles() method is used&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3747,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":""},"featured_image_src":null,"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"featured":false,"featured-large":false},"uagb_author_info":{"display_name":"vcxdevwpadmin","author_link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/author\/vcxdevwpadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file. Table of Contents Upload File to Share Download Shared File&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4995"}],"collection":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/comments?post=4995"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4995\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3747"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}