Media Sharing in Chat

Enhanced chat functionality with image, video, and file sharing capabilities

Media Upload

  • Support for images (JPEG, PNG, GIF, WebP)
  • Video sharing (MP4, WebM, QuickTime)
  • Document sharing (PDF, DOC, TXT)
  • File size limit: 10MB per file
  • Multiple file selection

Media Display

  • Inline image preview in chat
  • Video player with controls
  • File download with size info
  • Full-screen image modal
  • Responsive design

Security Features

  • File type validation
  • Size restrictions
  • Secure file storage
  • User authentication required
  • Event-based access control

User Experience

  • Drag & drop file selection
  • Media preview before sending
  • Upload progress indication
  • Error handling & notifications
  • Mobile-friendly interface

Implementation Status

Frontend Interface: Complete with media upload buttons and preview

File Validation: Client-side and server-side validation implemented

Backend API: Media upload endpoint created (chat-media.php)

Database Schema: Enhanced to support media messages

Security: File type restrictions and size limits in place

API Endpoints

POST /api/chat-media.php - Handles file uploads for chat messages - Validates file type and size - Stores files securely in uploads/chat/ - Creates database records for media messages GET /api/tourist.php?action=get-chat-messages&event_id={id} - Retrieves chat messages including media - Returns file URLs and metadata - Supports pagination and filtering POST /api/tourist.php?action=send-chat-message - Enhanced to support media message types - Handles text, image, video, and file messages

Supported Media Types

Images

JPEG, PNG, GIF, WebP
Max: 10MB

Videos

MP4, WebM, QuickTime
Max: 10MB

Documents

PDF, DOC, DOCX, TXT
Max: 10MB

Archives

ZIP, RAR
Max: 10MB

How to Test

  1. Login to the tourist dashboard
  2. Book an event to get access to its chat room
  3. Navigate to the "Event Chat" section
  4. Click the paperclip icon next to the message input
  5. Select media type (Images, Videos, or Files)
  6. Choose files from your device
  7. Preview selected media and click "Send Media"
  8. View shared media in the chat with other participants
Go to Chat Back to Home

Note: Media sharing is only available to authenticated users who have booked tickets for events. All uploaded files are stored securely and are only accessible to chat participants.