You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at your implementation, it does not seem like you followed the documentation.
Try defining the two server endpoints in the documentation along with the suggested single client code.
The local file upload is implemented using the database. So if the files have not been uploaded and correctly registered in the database the server won't be able to find it.
The session.storage.createDirectFileUploadDescription method ensures that the database is ready for the file upload. And
var uploader =FileUploader(uploadDescription);
await uploader.upload(myStream);
ensures that the file is correctly uploaded to the server and is ready to be served.
Give this a go and let me know if you run into any more issues.
Activity
SandPod commentedon Aug 5, 2024
Hey @hidayet-poscu 👋
Did you follow the steps in the documentation? https://docs.serverpod.dev/concepts/file-uploads
More specifically the steps on the client: https://docs.serverpod.dev/concepts/file-uploads#client-side-code
How does your code for uploading look?
Is the file actually uploaded to the server?
The file upload does not work with Serverpod mini since it requires a database.
xyzbilal commentedon Aug 5, 2024
Hey @SandPod I also have similar problem with getting public url or we do not understand exactly how to implement the logic.
this function is endpoint function to store files in a folder and it creates folder an file under server folder with no problem.
also retrieving file from client side is also with this function is also has no proplem
endpoint function
in client side calling retrieveFile() function works fine downloading file as ByteData ane converting it to file is also ok.
The problem is when we try to make url public and try to get or show file directly using url I cant success.
I tried http://localhost:8080/uploads/file.pdf or http://localhost:8080/uploads/previews/file.png which are where I save files also is not useful for the purpose.
Thanks for any kind of info.
Edit : I wonder if my issue and the question are different issues
SandPod commentedon Aug 5, 2024
Looking at your implementation, it does not seem like you followed the documentation.
Try defining the two server endpoints in the documentation along with the suggested single client code.
The local file upload is implemented using the database. So if the files have not been uploaded and correctly registered in the database the server won't be able to find it.
The
session.storage.createDirectFileUploadDescriptionmethod ensures that the database is ready for the file upload. Andensures that the file is correctly uploaded to the server and is ready to be served.
Give this a go and let me know if you run into any more issues.
xyzbilal commentedon Aug 6, 2024
my problem was saving files to local directory of server instead of database. I created own files to solve the problem and its working fine.
I also created PR for it if someone else needs it. PR