0144c8f0636b4498055e67a1c772da68de25aeb7
max
  Wed Jan 19 05:48:51 2022 -0800
making it impossible for users to upload bigBed, bigWig or BAM files on hgCustom, refs #8155

diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index 6758f16..cc675d0 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -309,31 +309,46 @@
         cgiTableField("Data:");
     else
         cgiTableField("Paste in replacement data:");
     }
 else
     cgiTableField("Paste URLs or data:");
 
 if (isUpdateForm && dataUrl)
     cgiTableField("&nbsp");
 else
     {
     puts("<TD ALIGN='RIGHT'>");
     puts("Or upload: ");
     cgiMakeFileEntry(hgCtDataFile);
     cgiTableFieldEnd();
+    jsInline(
+            "$(\"[name='hgt.customFile']\").change(function(ev) { \n"
+            "   var fname = ev.target.files[0].name; \n"
+            "   var ext = fname.split('.').pop().toLowerCase(); \n"
+            "   var warnExts = ['bigbed', 'bb', 'bam', 'vcf.gz', 'bigwig', 'bw', 'jpeg', 'pdf', 'jpg', 'png'];\n"
+            "   if (warnExts.indexOf(ext) >= 0) {\n"
+            "       alert('You are trying to upload a binary file on this page. This usually does not work. The Genome Browser server needs access to binary files via the internet.'+"
+            "          ' Therefore, you will need to store the files on a web server, then paste the URLs to them on this page, or you can upload a text file with \"track\" lines '+"
+            "          ' and configuration settings to points to the file URLs. For more information, please read the documentation '+"
+            "          ' referenced at the top of this page or contact us.');\n"
+            "       $(\"[name='hgt.customFile']\")[0].value = '';"
+            "   }\n"
+            "});\n"
+            );
     }
+
 if (!isUpdateForm)
     {
     cgiSimpleTableFieldStart();
     if (warnOnly)
 	{
 	cgiMakeButtonWithOnClick("ContinueWithWarn", "Continue with Warning", NULL, "return submitClick(this);");
 	printf("&nbsp;");
 	jsInline(
 	    "$('textarea').change(function() {\n"
 	    "    $('#ContinueWithWarn').hide();\n"
 	    "});\n");
 	}
     cgiMakeButtonWithOnClick("Submit", "Submit", NULL, "return submitClick(this);");
     printf("<img id='loadingImg' src='../images/loading.gif' />\n");
     cgiTableFieldEnd();