/
var
/
www
/
barefootlaw.org
/
will-generator
/
test
/
Upload File
HOME
<?php // Handle form submission if ($_SERVER["REQUEST_METHOD"] == "POST") { // Check if file was uploaded successfully if (isset($_FILES["signature"]) && $_FILES["signature"]["error"] == UPLOAD_ERR_OK) { // Upload the image file $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["signature"]["name"]); // Check if file already exists if (file_exists($target_file)) { echo "Error: File already exists."; } else { // Move the uploaded file to the target directory if (move_uploaded_file($_FILES["signature"]["tmp_name"], $target_file)) { // Specify absolute path to Python script $python_script = "process_image.py"; // Call the Python script for image processing $output = shell_exec("python $python_script " . $target_file); // Check if Python script execution was successful if ($output === false) { echo "Error: Failed to execute Python script."; } else { echo $output; } } else { echo "Error: Unable to move file."; } } } else { // Handle file upload error echo "Error: File upload failed."; // Output specific file error if available if (isset($_FILES["signature"]["error"])) { echo " Error code: " . $_FILES["signature"]["error"]; } } } ?>