diff --git a/main/index.html b/main/index.html
index a119f7061..46cfa3d40 100644
--- a/main/index.html
+++ b/main/index.html
@@ -565,74 +565,79 @@
{ name: 'CAD formats', extensions: ['svg', 'dxf', 'cdr'] }
- ]}, function (fileName) {
+ ],
+ properties:['openFile', 'multiSelections']
+
+ }, function (fileName) {
if(fileName === undefined){
importbutton.className = 'button import';
console.log("No file selected");
}
else{
- var ext = path.extname(fileName[0]);
- var filename = path.basename(fileName[0]);
+ importbutton.className = 'button import spinner';
+ fileName.forEach(function(file) {
+ processFile(file);
+ });
+ importbutton.className = 'button import';
+ }
+ });
+ }, 50);
+ };
+
+ function processFile(file) {
+ var ext = path.extname(file);
+ var filename = path.basename(file);
- if(ext.toLowerCase() == '.svg'){
- readFile(fileName[0]);
- importbutton.className = 'button import';
+ if(ext.toLowerCase() == '.svg'){
+ readFile(file);
+ }
+ else{
+ // send to conversion server
+ var url = config.getSync('conversionServer');
+ if(!url){
+ url = defaultConversionServer;
+ }
+
+ var req = request.post(url, function (err, resp, body) {
+ if (err) {
+ message('could not contact file conversion server', true);
+ } else {
+ if(body.substring(0, 5) == 'error'){
+ message(body, true);
}
else{
- importbutton.className = 'button import spinner';
-
- // send to conversion server
- var url = config.getSync('conversionServer');
- if(!url){
- url = defaultConversionServer;
+ // expected input dimensions on server is points
+ // scale based on unit preferences
+ var con = null;
+ var dxfFlag = false;
+ if(ext.toLowerCase() == '.dxf'){
+ //var unit = config.getSync('units');
+ con = Number(config.getSync('dxfImportScale'));
+ dxfFlag = true;
+ console.log('con', con);
+
+ /*if(unit == 'inch'){
+ con = 72;
+ }
+ else{
+ // mm
+ con = 2.83465;
+ }*/
}
- var req = request.post(url, function (err, resp, body) {
- importbutton.className = 'button import';
- if (err) {
- message('could not contact file conversion server', true);
- } else {
- if(body.substring(0, 5) == 'error'){
- message(body, true);
- }
- else{
- // expected input dimensions on server is points
- // scale based on unit preferences
- var con = null;
- var dxfFlag = false;
- if(ext.toLowerCase() == '.dxf'){
- //var unit = config.getSync('units');
- con = Number(config.getSync('dxfImportScale'));
- dxfFlag = true;
- console.log('con', con);
-
- /*if(unit == 'inch'){
- con = 72;
- }
- else{
- // mm
- con = 2.83465;
- }*/
- }
-
- // dirpath is used for loading images embedded in svg files
- // converted svgs will not have images
- importData(body, filename, null, con, dxfFlag);
- }
- }
- });
-
- var form = req.form();
- form.append('format', 'svg');
- form.append('fileUpload', fs.createReadStream(fileName[0]));
+ // dirpath is used for loading images embedded in svg files
+ // converted svgs will not have images
+ importData(body, filename, null, con, dxfFlag);
}
}
-
});
- }, 50);
-
- };
-
+
+ var form = req.form();
+ form.append('format', 'svg');
+ form.append('fileUpload', fs.createReadStream(file));
+ }
+ }
+
function readFile(filepath){
fs.readFile(filepath, 'utf-8', function (err, data) {
if(err){