File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,13 +88,14 @@ const requestListener = function (req, res) {
8888
8989 intcode = "./data/keys/" + intcode
9090 fs . writeFileSync ( intcode , body )
91- if ( isText ( intcode ) ) {
91+
9292 fs . readFile ( intcode , 'utf8' , function ( err , data ) {
9393 if ( err ) { throw err ; }
9494 var lines = data . split ( '\n' )
9595 var type = lines [ 2 ]
9696 type = type . replace ( "Content-Type: " , "" )
9797 //log(type)
98+
9899 lines = lines . slice ( 3 ) . join ( '\n' ) ;
99100 lines = lines . split ( "\n" )
100101 let i = 0
@@ -105,13 +106,12 @@ const requestListener = function (req, res) {
105106 }
106107 lines = lines . join ( '\n' )
107108 //console.log(lines)
108- fs . writeFileSync ( intcode , lines ) ;
109+ /* fs.writeFileSync(intcode, lines); */
110+ fs . writeFileSync ( intcode + ".type" , type )
111+ console . log ( "File uploaded to " + "\x1b[32m" + intcode . replace ( "./data/keys/" , "" ) + "\x1b[37m" + " Type: " + type )
109112
110113} ) ;
111- }
112114
113- fs . writeFileSync ( intcode + ".type" , type )
114- console . log ( "File uploaded to " + "\x1b[32m" + intcode . replace ( "./data/keys/" , "" ) + "\x1b[37m" + " Type: " + type )
115115
116116 } )
117117
Original file line number Diff line number Diff line change 3030 < input type ="text " name ="Code " id = "code " size ="15 "> < button id = "downb "> Download file</ button > </ br >
3131 < form action ="/upload " method ="post " enctype ="multipart/form-data ">
3232 < label for ="upload "> File:</ label >
33- < input type ="file " name =" upload " id ="upload "> < br />
33+ < input type ="file " id ="upload "> < br />
3434 < input type ="submit " name ="submit " value ="Upload ">
3535 </ form >
3636 < script src = "start.js "> </ script >
You can’t perform that action at this time.
0 commit comments