diff --git a/server.js b/server.js
index 05837d496153364f6df3b30d9c9d0bfc633fac00..a9e26759748210bb757dfc1f50337772a1d8ae0e 100644
--- a/server.js
+++ b/server.js
@@ -61,6 +61,8 @@ app.use("/cart", cartRoutes);
 app.use("/order", orderRoutes);
 app.use("/products", productRoutes);
 
+app.use("/uploads", express.static(path.join(__dirname, "uploads")));
+
 //Middlewareเน€เธŠเน‡เธ„Login
 const isLoggedIn = (req, res, next) => {
     if (req.session.user) {
diff --git a/shop-routes/product.js b/shop-routes/product.js
index bb5acd69543712729f1596e65ed090c2f0bcf2e3..6dc88d7025892f0f6aa160eec9166c1d09534212 100644
--- a/shop-routes/product.js
+++ b/shop-routes/product.js
@@ -42,37 +42,35 @@ router.get("/add", (req, res) => {
 
 // เน€เธžเธดเนˆเธกเธชเธดเธ™เธ„เน‰เธฒเนƒเธซเธกเนˆเธžเธฃเน‰เธญเธกเธฃเธนเธ›
 router.post("/add", upload.single("image"), async (req, res) => {
-    console.log("req.file:", req.file);  // เธ”เธนเธงเนˆเธฒ multer เน„เธ”เน‰เธฃเธฑเธšเน„เธŸเธฅเนŒเน„เธซเธก
-    console.log("req.body:", req.body);  // เธ”เธนเธ„เนˆเธฒเธ—เธตเนˆเธชเนˆเธ‡เธกเธฒเธˆเธฒเธเธŸเธญเธฃเนŒเธก
-
     try {
-        const { name, price, stock, description } = req.body;
+        console.log("Request received:", req.body);
+        console.log("Uploaded file:", req.file);
 
         if (!req.file) {
             console.error("Error: No file uploaded!");
-            return res.status(400).send("File upload failed");
+            return res.status(400).json({ message: "File upload failed" });
         }
 
+        const { name, price, stock, description } = req.body;
         const imagePath = "/uploads/" + req.file.filename;
-        console.log("imagePath:", imagePath);  // เธ•เธฃเธงเธˆเธชเธญเธšเธžเธฒเธ˜เน„เธŸเธฅเนŒเธฃเธนเธ›
-
-        try {
-            await pool.execute(
-                "INSERT INTO products (name, price, stock, description, image_url) VALUES (?, ?, ?, ?, ?)",
-                [name, price, stock, description, imagePath]
-            );
-        } catch (error) {
-            console.error("Database Error:", error);
-            return res.status(500).json({ error: "Database Error", details: error });
-        }
 
-        res.redirect("/products");
+        const sql = "INSERT INTO products (name, price, stock, description, image_url) VALUES (?, ?, ?, ?, ?)";
+        const values = [name, price, stock, description, imagePath];
+
+        console.log("SQL Query:", sql);
+        console.log("Values:", values);
+
+        await pool.execute(sql, values);
+        res.status(201).json({ success: true, message: "Product added successfully!" });
+
     } catch (error) {
-        console.error("Error adding product:", error);
-        res.status(500).send("Error adding product.");
+        console.error("Server Error:", error);
+        res.status(500).json({ message: "Internal Server Error", error: error.message });
     }
 });
 
+
+
 // เธ”เธถเธ‡เธ‚เน‰เธญเธกเธนเธฅเธชเธดเธ™เธ„เน‰เธฒเธ•เธฒเธก ID เนเธฅเธฐเนเธชเธ”เธ‡เธซเธ™เน‰เธฒเนเธเน‰เน„เธ‚
 router.get("/edit/:id", async (req, res) => {
     try {