From: <tob...@us...> - 2014-02-26 23:44:15
|
Revision: 7893 http://sourceforge.net/p/bigdata/code/7893 Author: tobycraig Date: 2014-02-26 23:44:11 +0000 (Wed, 26 Feb 2014) Log Message: ----------- Disallow uploads larger than 1MB and remove hidden field for containing them. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-26 20:35:12 UTC (rev 7892) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-26 23:44:11 UTC (rev 7893) @@ -41,8 +41,6 @@ </ul> </div> - <input id="load-hidden" type="hidden" name="large-file-contents"> - <p id="large-file-message">Your file is too large to display here, but will be uploaded as normal.</p> <textarea id="load-box" placeholder="(Type in or drag a file containing RDF data, a SPARQL update or a file path or URL)"></textarea> <p> <label for="load-type">Type:</label> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 20:35:12 UTC (rev 7892) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 23:44:11 UTC (rev 7893) @@ -135,32 +135,20 @@ var f = files[0]; // if file is too large, tell user to supply local path - if(f.size > 100 * 1048576) { + if(f.size > 1048576) { alert('File too large, enter local path to file'); $('#load-box').val('/path/to/' + f.name); setType('path'); - $('#load-file').val(''); $('#large-file-message').hide(); - return; - } - - // if file is small enough, populate the textarea with it - if(f.size < 10 * 1024) { - holder = '#load-box'; - $('#load-hidden').val(''); - $('#large-file-message').hide(); } else { - // store file contents in hidden input and clear textarea - holder = '#load-hidden'; - $('#load-box').val(''); - $('#large-file-message').show(); + // display file contents in the textarea + var fr = new FileReader(); + fr.onload = function(e2) { + $('#load-box').val(e2.target.result); + guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); + }; + fr.readAsText(f); } - var fr = new FileReader(); - fr.onload = function(e2) { - $(holder).val(e2.target.result); - guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); - }; - fr.readAsText(f); $('#load-file').val(''); } @@ -243,8 +231,6 @@ 'turtle': 'text/turtle'}; var sparql_update_commands = ['INSERT', 'DELETE']; -// stores the id of the element that contains the data to be sent -var holder = '#load-box'; $('#load-file').change(handleFile); $('#load-box').on('dragover', handleDragOver); @@ -255,7 +241,7 @@ $('#load-load').click(function() { var settings = { type: 'POST', - data: $(holder).val(), + data: $('#load-box').val(), success: updateResponseXML, error: updateResponseError } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |