🔍 Live Chat Image Upload - Path Configuration Test

Kiểm tra cấu hình đường dẫn upload ảnh

📊 Server Information

DOCUMENT_ROOT:
/home/admindtdagency/public_html/chat.dtdagency.vn
Current Script:
/home/admindtdagency/public_html/chat.dtdagency.vn/live_chat/test_upload_path.php
Current Directory:
/home/admindtdagency/public_html/chat.dtdagency.vn/live_chat
HTTP Host:
chat.dtdagency.vn
Protocol:
https

📁 Upload Directory Configuration

Upload Directory Path:
/home/admindtdagency/public_html/chat.dtdagency.vn/uploads/live_chat_images/
Real Path:
/home/admindtdagency/public_html/chat.dtdagency.vn/uploads/live_chat_images
Directory Exists:
✅ YES
Writable:
✅ YES - Can upload files

🖼️ Files in Upload Directory

Found 1 file(s):

🔗 URL Generation Test

Test Filename:
chat_img_test123.jpg
Generated URL:

ℹ️ Note: This is how URLs will be generated when images are uploaded. If you see a 404 error when clicking the link above, the path configuration is correct (file just doesn't exist yet).

✅ Recommended Actions

🎉 All checks passed! Your upload configuration is correct.

💻 Current Configuration in Code

This is what should be in your image_upload_handler.php:

<?php
// Line ~12
define('UPLOAD_DIR', $_SERVER['DOCUMENT_ROOT'] . '/uploads/live_chat_images/');

// Line ~95
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'];
$image_url = $protocol . '://' . $host . '/uploads/live_chat_images/' . $new_filename;
?>

🧪 Next Steps

  1. If all checks passed ✅ → Try uploading an image in the live chat
  2. If directory doesn't exist ❌ → Run the mkdir command above via SSH
  3. If not writable ❌ → Run the chmod command above via SSH
  4. After fixing → Refresh this page to verify
  5. Test upload in customer or admin chat interface