<?php
require 'db_config.php'; // Ensure necessary connections/configs are included

$response = array();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['image'])) {
    $upload_dir = 'uploads/';
    // ... (Your existing image processing, path generation, move_uploaded_file logic) ...
    // Assume you successfully saved the file to $image_path

    if (/* File save was successful */ true) { 
        $response['status'] = 'success';
        // IMPORTANT: Return the saved path so the Android app can use it
        $response['image_path'] = $image_path; 
    } else {
        $response['status'] = 'error';
        $response['message'] = 'Error saving image file.';
    }
} else {
    $response['status'] = 'error';
    $response['message'] = 'Invalid request or missing image file.';
}

header('Content-Type: application/json');
echo json_encode($response);
?>