Comments (24)
@LivioGama If you remove the type="local"
from the File
component it should work. FilePond will now load the file by URL.
The type="local"
is only for files that are inaccessible from the web. When type is set to local the file is requested via the server load
end point ( which by default returns a webpage in a react app, which is also why the file is so tiny ).
If you inspect the network tab of your developer tools you'll see the request load?=filename.png
.
from filepond.
Have you tried implementing the load API end point? It basically loads the file and returns it from the server, you can find and example here: https://github.com/pqina/filepond-boilerplate-php/blob/master/public/api/index.php#L45
I'm thinking of making this optional ( as when the file is accessible from the browser it's unnecessary ).
from filepond.
@LivioGama Okay, I seem to have reproduced the problem here, working on a fix.
from filepond.
Hey! That’s a bit odd, I’m currently on a short trip, will look into this when I get back later this week.
from filepond.
There is no picture preview in the solution you gave me. I would expect the remote image to have the same look than the ‘just uploaded successfully’ picture
from filepond.
Have you removed the type="local"
?
from filepond.
Removing the type=local
will cause the file to upload, then the model will change and the page will re-render, then the file upload again, in an infinite loop. I will try to disable auto upload to see what it does, I'm coming back to you.
from filepond.
Hi!
It's explained on the server page in the docs.
So this would be the default:
<FilePond allowMultiple={true}
maxFiles={3}
server={{
load: "load.php?id="
}}>
</FilePond>
You could try using a custom function and getting the file with fetch
. I haven't tested this but it should work.
<FilePond allowMultiple={true}
maxFiles={3}
server={{
load: (uniqueFileId, load, error) => {
fetch(uniqueFileId)
.then(res => res.blob())
.then(load)
.catch(error)
}
}}>
</FilePond>
from filepond.
Thanks a lot for your patience !
Unfortunately it is not working, the load function is never called. Here is my ready to use example :
<FilePond allowMultiple={false}
server={{
load: (uniqueFileId, load, error) => {
console.log('TEST')
fetch(uniqueFileId)
.then(res => res.blob())
.then(load)
.catch(error)
}
}}>
<File source='http://liviogama.com/img/livio.png'/>
</FilePond>
No "TEST" is shown in the log. Note that if I add a process
function, and drop a file, it will upload successfully !
from filepond.
Actually I tried :
<FilePond allowMultiple={false}
server={{
process: this.handleProcessing,
revert: this.handleRevert,
fetch: this.handleFetch,
restore: this.handleRestore,
load: this.handleLoad
}}>
<File source='http://liviogama.com/img/livio.png'/>
</FilePond>
And only the process
method is called :(
from filepond.
@LivioGama Sorry for the confusion, the type="local"
needs to be present on the File
for the load method to be called.
from filepond.
Even with type="local" no other method than process are called for me. I'm using the latest "react-filepond": "^2.0.4" version
from filepond.
@LivioGama Just publish version 2.0.6
of the react adapter and version 1.4.0
of the core library. Please let me know if this fixes the issue.
from filepond.
@rikschennink - please your help on this.
- I am using something similar to below code as recommended above. Load method is called, however image is not loaded in preview mode. It only shows image name in a box with dark background .
- When I click in "Remove" for an initial file, I realized that server.revert method is not called, please would you tell why?
- Is there any way we can allow users to download initial files from filepond component?
<FilePond allowMultiple={true} maxFiles={3} server={{ revert: this.handleRevert, load: this.handleLoad }} > <File key={123} source={imageURL1} origin='local' /> <File key={456} source={imageURL2} origin='local' /> </FilePond>
from filepond.
Hi!
-
Does your load method return the file data?
-
Revert is only called for temporary files, you can set up a custom remove method in true onremovefile callback.
-
There’s currently no default functionality for this, but maybe a click handler on the filepond root will give you the target element clicked and you can use that to get the matching file from FilePond and serve that file to the user as a download?
from filepond.
hi @rikschennink , pls your help with question #1 & #3
1.- Yes, it does.
2.- Got it.
3.- Just added onClick={this.handleClick} as property in FilePond, and defined the handler below but it is not called. Any suggestion please?
handleClick = e => {
console.log(e);
}
from filepond.
-
No errors in dev console? If not, can you past the
load
function here? -
Great!
-
Then I'm not sure, maybe you can use JavaScript
addEventListener
to catch events that bubble up the DOM tree.
from filepond.
Hi there, is there an example for the jquery adapter as well? I can't get the image fetched after dragdropping it form google image search for instance.
from filepond.
@mverstegen Please post questions to StackOverflow
from filepond.
Does anyone solve this issue?
from filepond.
Have you tried implementing the load API end point? It basically loads the file and returns it from the server, you can find and example here: https://github.com/pqina/filepond-boilerplate-php/blob/master/public/api/index.php#L45
I'm thinking of making this optional ( as when the file is accessible from the browser it's unnecessary ).
i also have this issue, but the given link is not even public.
from filepond.
@dashawk The link indeed doesn't work.
Should be: https://github.com/pqina/filepond-server-php/blob/master/index.php
from filepond.
@rikschennink The image is not getting preview
code
<FilePond
style={{ marginTop: "10px" }}
files={files}
allowMultiple={true}
allowReorder={true}
onupdatefiles={setFiles}
onreorderfiles={setFiles}
onremovefile={(error, file) =>
deleteRoomTypeImgs(file.filename)
}
imagePreviewHeight="125px"
credits={("", "")}
labelIdle='Drag and Drop your files or Browse'
server={{
load: "https://picsum.photos/200/300",
}}
/>
tried this code also still facing same issue
<FilePond
style={{ marginTop: "10px" }}
files={files}
allowMultiple={true}
allowReorder={true}
onupdatefiles={setFiles}
onreorderfiles={setFiles}
onremovefile={(error, file) =>
deleteRoomTypeImgs(file.filename)
}
imagePreviewHeight="125px"
credits={("", "")}
type="local"
labelIdle='Drag and Drop your files or <span class="filepond--label-action">Browse</span>'
server={{
load: "https://picsum.photos/200/300",
}}
>
<File source="https://picsum.photos/200/300" type="local" />
</FilePond>
from filepond.
@LivioGama is your issue resolved? i m still facing the same issue
from filepond.
Related Issues (20)
- Example with transfer(id) on Server advanced process
- [Bug] black image uploaded instead HOT 1
- [Bug] The method getFileEncodeDataURL() stopped working. HOT 1
- [Feature] Prevent video reordering to first position HOT 1
- [Feature] Option to Disable the Remove File Button HOT 2
- [Bug] Please remove the shaking animation.
- [Feature] Customize Animation Duration
- [Bug] [react-filepond] State update in onremovefile event handler triggers file re-upload HOT 2
- [Bug] url.split is not a function when attempting to load "local" images (React 18) HOT 6
- Converting Headers key to CamelCase? HOT 1
- Bootstrap 5 image preview as gallery [Feature] HOT 2
- [Feature] How to show file limits to a custom html area with a selector HOT 5
- filepond--list-scroller overlays other elements [Bug] HOT 1
- Display a custom message on Upload complete, including data from the server response HOT 3
- I'm not able to drag an attachment from Outlook or Gmail HOT 3
- [Bug?] HOT 1
- [Bug] typings missing processfiles event HOT 1
- Upload of a large file (100s Mb) restarted each time a response received from back-end HOT 3
- Foreign character failure - unescape(encodeURIComponent(options.headers[key])); [Bug] HOT 2
- Filepond not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filepond.