Works with ANY form, ANY server, ANY website
Step 1: Include the tiny helper script (no modal needed) after form tag:
<script src="https://photoupload.tokyobigsale.com/upload-component/upload-embed.js"></script>
<script>
setupUploadComponent({
// Point to where upload.php lives
uploadServer: 'https://photoupload.tokyobigsale.com',
titleFieldId: 'photoTitle' // optional; defaults to photoTitle
// onUpload: (url, fieldId, fileInfo) => {} // optional callback
});
</script>
Step 2: Add your form fields (any IDs you like):
<input type="text" id="myPhotoField" readonly>
<button type="button" onclick="openUploadPopup('myPhotoField')">Upload</button>
<textarea id="myGalleryField" rows="3" readonly></textarea>
<button type="button" onclick="openUploadPopup('myGalleryField', { multiple: true })">Upload Photos</button>
Optional: React to uploads (analytics, previews, etc.):
setupUploadComponent({
uploadServer: 'https://photoupload.tokyobigsale.com',
onUpload: (url, fieldId, fileInfo) => {
console.log('Uploaded to', url, 'field', fieldId, fileInfo);
}
});
| What | Example | Notes |
|---|---|---|
| Field ID | id="myPhotoField" |
Use ANY name you want |
| Button onclick | onclick="openUploadPopup('myPhotoField')" |
Match the field ID above |
| Upload Server URL | uploadServer: 'https://photoupload.tokyobigsale.com' |
MOST IMPORTANT! Must point to where upload.php is served |
| Multiple flag | openUploadPopup('field', { multiple: true }) |
multiple true appends newline-separated URLs |
myPhotoField, myGalleryField).openUploadPopup('fieldId', { multiple: true|false }).uploadServer option in setupUploadComponent.
<input type="text" id="productImage">
<button onclick="openUploadPopup('productImage')">
Upload Image
</button>
<textarea id="attachments"></textarea>
<button onclick="openUploadPopup('attachments', { multiple: true })">
Add Files
</button>
uploadServer must point to the live folder containing upload.php (e.g., https://photoupload.tokyobigsale.com).photoupload.tokyobigsale.com sends permissive CORS headers for your sites.