diff --git a/server.js b/server.js index 2d3d397..8245e5f 100644 --- a/server.js +++ b/server.js @@ -252,7 +252,7 @@ app.post('/api/hero-upload', requireAuth, (req, res) => { const buffer = Buffer.from(matches[2], 'base64'); const uploadDir = path.join(__dirname, 'public', 'uploads'); if (!fs.existsSync(uploadDir)) fs.mkdirSync(uploadDir, { recursive: true }); - const filename = `hero.${ext}`; + const filename = `hero-${Date.now()}.${ext}`; fs.writeFileSync(path.join(uploadDir, filename), buffer); const publicPath = `/uploads/${filename}?t=${Date.now()}`; res.json({ path: publicPath }); @@ -272,7 +272,7 @@ app.post('/api/mood-upload', requireAuth, (req, res) => { const buffer = Buffer.from(matches[2], 'base64'); const uploadDir = path.join(__dirname, 'public', 'uploads'); if (!fs.existsSync(uploadDir)) fs.mkdirSync(uploadDir, { recursive: true }); - const filename = `mood-${index}.${ext}`; + const filename = `mood-${index}-${Date.now()}.${ext}`; fs.writeFileSync(path.join(uploadDir, filename), buffer); res.json({ path: `/uploads/${filename}?t=${Date.now()}` }); } catch (e) {