Welcome to the Simple File Upload PHP Uploader documentation. This documentation provides guidance on how to add the Simple File Upload PHP Uploader to your projects. Let's get started!
Add the following script tag to the `head`
section of your application.
This replaces'YOUR_BUCKET_UUID'
with your actual bucket UUID:
<script src="https://app.simplefileupload.com/buckets/YOUR_BUCKET_UUID.js"></script>
Add a hidden input field into your HTML form where you want the file uploader to appear:
<input type="hidden" name="uploaded_file_url" class="simple-file-upload">
This field will handle file uploads, and its value will automatically be set to the uploaded file's URL.
In the PHP script that processes your form submission, retrieve the file URL:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$uploadedFileUrl = $_POST['uploaded_file_url'];
if (!empty($uploadedFileUrl)) {
echo "Uploaded file URL: " . htmlspecialchars($uploadedFileUrl);
} else {
echo "No file was uploaded.";
}
}
?>
When a user uploads a file, you’ll receive the file's URL in `$_POST['uploaded_file_url']`
. You can now save it or use it in your app.