Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size not available #32

Closed
kurtomerfaruk opened this issue Dec 16, 2022 · 7 comments
Closed

Size not available #32

kurtomerfaruk opened this issue Dec 16, 2022 · 7 comments

Comments

@kurtomerfaruk
Copy link

When I want to use FilePoster I get size unavailable. Is there something I missed with my codes as below?

`
FilePond.registerPlugin(
FilePondPluginFilePoster,
FilePondPluginImagePreview
);

FilePond.create(document.querySelector('input[name="cover"]'));
FilePond.setOptions({
    server: {
        url: "{{ config('filepond.server.url') }}",
        headers: {
            'X-CSRF-TOKEN': "{{ @csrf_token() }}",
        },
    },
    files: [
        {
            source: "http://127.0.0.1:8000/storage/covers/project-cover-639cf605b3251.png",
            options: {
                type: 'local',
                metadata: {
                    poster: "http://127.0.0.1:8000/storage/covers/project-cover-639cf605b3251.png",
                },
            }
        }
    ]
});

`

I am getting error Argument 1 passed to RahulHaque\Filepond\Services\FilepondService::offset() must be of the type string

How should I go about this?
Thanks

@rahulhaque
Copy link
Owner

@kurtomerfaruk where do you get the size unavailable? In the frontend or backend? You're passing file location in the source key which doesn't align with the documentation here. I would like to know why are you using this plugin for? There are many use cases. The last error happens when filepond fails to successfully talk to the server. Check your console if the xhr calls to backend is successful and you're getting a response.

@kurtomerfaruk
Copy link
Author

@rahulhaque I am getting the error on both sides. On the front end, I get the error that size cannot be used, and on the backend, I get the error Argument 1 passed to RahulHaque\Filepond\Services\FilepondService::offset() must be of the type string.

@kurtomerfaruk
Copy link
Author

Also when I check the backend, FilepondController return Response::make('Ok', 200)->withHeaders(['upload-offset' => $service->offset($request->patch)]); I see that the $request->patch field is null. what could be the reason for this

@rahulhaque
Copy link
Owner

@kurtomerfaruk thank you. You answered my first question. All the errors you've mentioned are related to filepond js not being able to successfully posting the files to the backend. When you drop a file in filepond js, it must communicate with the server first to get the server key. That's why I asked you inspect the request console. $request->patch comes to account when you're using chunk upload. Your example doesn't include that. If you want to load a file already uploaded, then you'll have to write your own endpoints. That's why ask you what purpose you're using fileposter plugin for. Please give some information about the rest.

@kurtomerfaruk
Copy link
Author

Can you give an example?

@rahulhaque
Copy link
Owner

@kurtomerfaruk I am sorry can you be a bit specific? Is the example in the documentation not working? Is it not working without the plugin you’re trying to use?

@kurtomerfaruk
Copy link
Author

Anyway, since the problem is not solved, I will try to solve my problem with another plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants