File tree Expand file tree Collapse file tree 5 files changed +17
-7
lines changed Expand file tree Collapse file tree 5 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -160,12 +160,14 @@ exports.image = function(req, res) {
160
160
} ;
161
161
162
162
exports . upload_file = function ( req , res ) {
163
- console . log ( req . files . files [ 0 ] ) ;
163
+ console . log ( req . file ) ;
164
+ console . log ( req . file . originalname ) ;
165
+ console . log ( req . file . path ) ;
164
166
165
- var temp_path = sanitize ( req . files . files [ 0 ] . path ) . trim ( ) ;
166
- var file_name = sanitize ( req . files . files [ 0 ] . name ) . trim ( ) ;
167
+ var temp_path = sanitize . trim ( req . file . path ) ;
168
+ var file_name = sanitize . trim ( req . file . originalname ) ;
167
169
file_name = file_name . replace ( " " , "_" ) ;
168
- var folder_path = sanitize ( req . body . path ) . trim ( ) . replace ( 'filesystem' , 'repositories' ) ;
170
+ var folder_path = sanitize . trim ( req . body . path ) . replace ( 'filesystem' , 'repositories' ) ;
169
171
170
172
var new_path = __dirname + '/..' + folder_path + file_name ;
171
173
new_path = path . resolve ( new_path ) ;
Original file line number Diff line number Diff line change 15
15
"later" : " ^1.2.0" ,
16
16
"method-override" : " 2.3.10" ,
17
17
"morgan" : " 1.9.0" ,
18
+ "multer" : " ^1.3.0" ,
18
19
"nedb" : " 1.8.0" ,
19
20
"node-pty" : " 0.7.4" ,
20
21
"pug" : " 2.0.0-rc.4" ,
Original file line number Diff line number Diff line change 89
89
"upload_file_form" : '<form class="upload-form" id="upload-file-form" action="/editor/upload" enctype="multipart/form-data">' +
90
90
'<span class="fileinput-button">' +
91
91
'<span>+ Upload File</span>' +
92
- '<input id="fileupload" type="file" name="files[] " data-url="/editor/upload" multiple>' +
92
+ '<input id="fileupload" type="file" name="obj " data-url="/editor/upload" multiple>' +
93
93
'</span>' +
94
94
'</form>'
95
95
} ;
816
816
817
817
function run_command ( command ) {
818
818
console . log ( "sending command: " + command ) ;
819
- occEditor . send_terminal_command ( command ) ;
819
+ term . send ( JSON . stringify ( { type : "input" , data : command } ) ) ;
820
+ //occEditor.send_terminal_command(command);
820
821
}
821
822
822
823
// Clean terminal
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ var express = require('express'),
7
7
morgan = require ( 'morgan' ) ,
8
8
app = express ( ) ,
9
9
expressWs = require ( 'express-ws' ) ( app ) ,
10
+ multer = require ( 'multer' ) ,
11
+ upload = multer ( { dest : './uploads' } ) ,
10
12
util = require ( 'util' ) ,
11
13
util = require ( 'util' ) ,
12
14
site = require ( './controllers/site' ) ,
@@ -83,7 +85,8 @@ app.get('/', site.index);
83
85
84
86
app . get ( '/editor' , editor . index ) ;
85
87
app . get ( '/editor/image' , editor . image ) ;
86
- app . post ( '/editor/upload' , editor . upload_file ) ;
88
+
89
+ app . post ( '/editor/upload' , upload . single ( 'obj' ) , editor . upload_file ) ;
87
90
88
91
app . post ( '/create/repository' , editor . create_repository ) ;
89
92
Original file line number Diff line number Diff line change
1
+ *
2
+ * /
3
+ ! .gitignore
You can’t perform that action at this time.
0 commit comments