Fixe Image Upload #1
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Neutral/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Neutral/pipeline/head This commit looks good
				
			This commit is contained in:
		@@ -38,8 +38,6 @@ router.post("/", function(req, res, next) {
 | 
			
		||||
 | 
			
		||||
    const image = req.files.apic
 | 
			
		||||
 | 
			
		||||
    console.log("test")
 | 
			
		||||
 | 
			
		||||
    if(req.headers.uploadforuser != null) {
 | 
			
		||||
 | 
			
		||||
        if(check.permLevel == 4) {
 | 
			
		||||
@@ -48,7 +46,8 @@ router.post("/", function(req, res, next) {
 | 
			
		||||
    
 | 
			
		||||
                var uploadPath = "";
 | 
			
		||||
                var uploadDir = __dirname.replace("routes","public" + path.sep + "images" + path.sep + "userspics" + path.sep)
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
               
 | 
			
		||||
                if(req.files.apic.mimetype == "image/png") {
 | 
			
		||||
        
 | 
			
		||||
                    uploadPath = req.headers.uploadforuser + ".png"
 | 
			
		||||
@@ -59,7 +58,7 @@ router.post("/", function(req, res, next) {
 | 
			
		||||
                    uploadPath =  req.headers.uploadforuser+ ".jpg"
 | 
			
		||||
                }
 | 
			
		||||
        
 | 
			
		||||
                image.mv(uploadPath, function(err) {
 | 
			
		||||
                image.mv(__dirname + path.sep + uploadPath, function(err) {
 | 
			
		||||
                    if(err) {
 | 
			
		||||
                        res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
 | 
			
		||||
                        console.log(err)
 | 
			
		||||
@@ -176,7 +175,7 @@ router.post("/", function(req, res, next) {
 | 
			
		||||
            uploadPath =  ntr.checkToken(req, res).name + ".jpg"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        image.mv(uploadPath, function(err) {
 | 
			
		||||
        image.mv(__dirname + path.sep + uploadPath, function(err) {
 | 
			
		||||
            if(err) {
 | 
			
		||||
                res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
 | 
			
		||||
                console.log(err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user