pull/212/head v1.0.275
openbuilds-engineer 2021-01-20 18:23:46 +02:00
rodzic d78c743b1a
commit 284e0f1e51
5 zmienionych plików z 24 dodań i 16 usunięć

Wyświetl plik

@ -1,3 +1,5 @@
v1.0.275: Fixed /upload page for large files
v1.0.274: Interface Firmware v1.43
v1.0.273: Cleanup of old resources v1.0.273: Cleanup of old resources
v1.0.272: New 3D viewer: Arc Support v1.0.272: New 3D viewer: Arc Support
v1.0.271: New 3D viewer: More lightweight, supports larger files, Render Progress percentage, antialiased graphics, opacity, etc; Prevent large files from loading to Gcode Editor, new RunJob method for large files v1.0.271: New 3D viewer: More lightweight, supports larger files, Render Progress percentage, antialiased graphics, opacity, etc; Prevent large files from loading to Gcode Editor, new RunJob method for large files

Wyświetl plik

@ -1,26 +1,25 @@
<form id="uploadform" enctype="multipart/form-data"> <form id="uploadform" enctype="multipart/form-data">
<input id="filename" name="file" type="file" accept=".gcode, .cnc, .tap, .nc" /></span> <input id="filename" name="file" type="file" accept=".gcode, .cnc, .tap, .nc" /></span>
<button onclick="stltobackend()">Upload</button> <button type="submit">Upload</button>
</form> </form>
<script type="text/javascript" src="lib/jquery/jquery.min.js"></script>
<script> <script>
function stltobackend() { $('#uploadform').submit(function(e) {
e.preventDefault();
$.ajax({ $.ajax({
url: '/upload', url: '/upload',
type: 'POST', type: 'POST',
data: new FormData($('#uploadform')[0]),
// Tell jQuery not to process data or worry about content-type
// You *must* include these options!
cache: false,
contentType: false,
processData: false, processData: false,
// Custom XMLHttpRequest contentType: false,
xhr: function() { cache: false,
var myXhr = $.ajaxSettings.xhr(); data: new FormData($('#uploadform')[0]),
return myXhr; enctype: 'multipart/form-data',
}, success: function() {
console.log('Uploaded sucessfully');
}
}); });
}
</script>
<script type="text/javascript" src="lib/jquery/jquery.min.js"></script> });
</script>

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -47,6 +47,8 @@ const drivelist = require('drivelist');
require('hazardous'); require('hazardous');
app.use(express.static(path.join(__dirname, "app"))); app.use(express.static(path.join(__dirname, "app")));
//app.use(express.limit('200M'));
// Interface firmware flash // Interface firmware flash
app.post('/uploadCustomFirmware', (req, res) => { app.post('/uploadCustomFirmware', (req, res) => {
@ -549,6 +551,7 @@ app.post('/upload', function(req, res) {
//debug_log(req) //debug_log(req)
uploadprogress = 0 uploadprogress = 0
var form = new formidable.IncomingForm(); var form = new formidable.IncomingForm();
form.maxFileSize = 300 * 1024 * 1024;
form.parse(req, function(err, fields, files) { form.parse(req, function(err, fields, files) {
// debug_log(files); // debug_log(files);
}); });
@ -563,6 +566,8 @@ app.post('/upload', function(req, res) {
if (uploadprogress != lastsentuploadprogress) { if (uploadprogress != lastsentuploadprogress) {
lastsentuploadprogress = uploadprogress; lastsentuploadprogress = uploadprogress;
} }
debug_log('Progress ' + uploadprogress + "% / " + bytesReceived + "b");
}); });
form.on('file', function(name, file) { form.on('file', function(name, file) {
@ -590,6 +595,8 @@ app.post('/upload', function(req, res) {
form.on('end', function() { form.on('end', function() {
//Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. //Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
res.end();
}); });
res.sendFile(__dirname + '/app/upload.html'); res.sendFile(__dirname + '/app/upload.html');

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "OpenBuildsCONTROL", "name": "OpenBuildsCONTROL",
"version": "1.0.274", "version": "1.0.275",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"description": "OpenBuildsCONTROL CNC Machine Interface Software", "description": "OpenBuildsCONTROL CNC Machine Interface Software",
"author": "github.com/openbuilds <webmaster@openbuilds.com>", "author": "github.com/openbuilds <webmaster@openbuilds.com>",