pqina / svelte-filepond

🔌 A handy FilePond adapter component for Svelte
MIT License
247 stars 10 forks source link

Example of svelte filepond presigned url #14

Closed obikay200 closed 2 years ago

obikay200 commented 2 years ago

HI

I have been tryng to get a working model together to request a unique url for each file item to upload to S3.

<script>
import FilePond from 'svelte-filepond';

// a reference to the component, used to call FilePond methods
// for example `pond.getFiles()` will return the active files
let pond;

// the name to use for the internal file input
let name = 'filepond';

// handle filepond events
function handleInit() {
    console.log('FilePond has initialised');
}

function handleAddFile(err, fileItem) {
    console.log('A file has been added', fileItem.filename);
}

function handleProcessFileStart(fileItem) {
    console.log(fileItem)
    console.log(fileItem.filename)
    pond.server = 'http://192.168.0.100',
    console.log('uploading to: ', pond.server)

}
</script>

<div class="uploader">

        <FilePond bind:this={pond} {name}
            server="upload_url_not_set"
            allowMultiple={true}
            oninit={handleInit}
            onaddfile={handleAddFile}
            onprocessfilestart={handleProcessFileStart}
            allowProcess={true}
            credits={false}
            instantUpload={false}
        />
</div>

from the code above im trying to set the server upload for each item, with a default of upload_url_not_set, but the value is not overriding the default

Are you able to provide an example of how to do this?

Thanks

rikschennink commented 2 years ago

As requested in the issue template, please ask questions on Stack Overflow and tag them with "filepond"