35696-vm/index.php
Flatlogic Bot df3eb075fa initial
2025-11-13 17:54:09 +00:00

108 lines
5.0 KiB
PHP

<?php
$upload_dir = 'uploads/';
$uploaded_file_path = null;
$error_message = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['vehicleImage'])) {
if ($_FILES['vehicleImage']['error'] === UPLOAD_ERR_OK) {
$tmp_name = $_FILES['vehicleImage']['tmp_name'];
$name = basename($_FILES['vehicleImage']['name']);
$file_ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
$allowed_ext = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($file_ext, $allowed_ext)) {
// Create a unique filename to avoid conflicts
$new_filename = uniqid('', true) . '.' . $file_ext;
$destination = $upload_dir . $new_filename;
if (move_uploaded_file($tmp_name, $destination)) {
$uploaded_file_path = $destination;
} else {
$error_message = 'Failed to move uploaded file.';
}
} else {
$error_message = 'Invalid file type. Please upload a JPG, PNG, or GIF image.';
}
} else {
$error_message = 'File upload failed with error code: ' . $_FILES['vehicleImage']['error'];
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Acyfer Vision</title>
<meta name="description" content="Vehicle damage analysis powered by AI. Upload photos to get instant reports.">
<meta name="keywords" content="car damage analysis, vehicle inspection, AI image recognition, automotive diagnostics, collision repair estimate, auto body assessment, vehicle photo upload, Acyfer Vision, Built with Flatlogic Generator">
<meta property="og:title" content="Acyfer Vision">
<meta property="og:description" content="Vehicle damage analysis powered by AI. Upload photos to get instant reports.">
<meta property="og:image" content="">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body>
<header class="p-3 mb-4 text-white header-gradient">
<div class="container">
<h1 class="h3">Acyfer Vision</h1>
</div>
</header>
<main class="container">
<div class="card p-4 p-md-5 border-0 shadow-sm">
<div class="row align-items-center">
<div class="col-lg-6 mb-4 mb-lg-0">
<h2 class="h1 mb-3">Upload Vehicle Photo</h2>
<p class="lead mb-4">Get an instant AI-powered damage analysis. Drag and drop an image or click to select a file.</p>
<form id="uploadForm" action="index.php" method="post" enctype="multipart/form-data">
<div id="uploadZone" class="upload-zone">
<i data-feather="upload-cloud" class="icon text-primary"></i>
<p class="m-0"><strong>Drag & drop</strong> or <strong>click to browse</strong></p>
<p class="text-muted small">Supports: JPG, PNG, GIF</p>
</div>
<input type="file" name="vehicleImage" id="vehicleImage" class="d-none">
<button type="submit" class="btn btn-primary btn-lg mt-3">Upload Image</button>
</form>
</div>
<div class="col-lg-6">
<?php if ($error_message): ?>
<div class="alert alert-danger">
<?php echo htmlspecialchars($error_message); ?>
</div>
<?php endif; ?>
<?php if ($uploaded_file_path): ?>
<div class="text-center">
<h3 class="h5 mb-3">Analysis Result</h3>
<div class="card result-card">
<img src="<?php echo htmlspecialchars($uploaded_file_path); ?>" class="card-img-top" alt="Uploaded Vehicle Image">
<div class="card-body">
<h5 class="card-title">Image Received</h5>
<p class="card-text d-flex align-items-center justify-content-center">
Status: <span class="badge bg-info text-dark ms-2">Pending Analysis</span>
</p>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</main>
<footer class="text-center text-muted py-4 mt-5">
<p>&copy; <?php echo date("Y"); ?> Acyfer Vision. All rights reserved.</p>
</footer>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
feather.replace();
</script>
</body>
</html>