Welcome to the Simple File Upload JavaScript Uploader documentation. This documentation provides guidance on how to add the Simple File Upload JavaScript 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.
Use JavaScript to listen for the `fileUploadSuccess`
event and retrieve the uploaded file's URL:
document.getElementById('file_url').addEventListener('fileUploadSuccess', function() {
console.log(this.value); // This is the URL of the uploaded file
});
Once the upload is successful, you can send the URL to your server or handle it directly in your app as needed.