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
I'd like to set up a chunk file upload. However, Filepond sends PATCH requests to the current page and not to the ‘process’ endpoint.
The first POST request works correctly and I get an Transfer ID from my back-end. However, filepond then sends PATCH requests to the URL on the current page. Shouldn't it send the requests to /process?
Thank you
Reproduction
This is my configuration:
<linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/filepond/dist/filepond.min.css"><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css"><scriptsrc="https://cdn.jsdelivr.net/npm/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"></script><scriptsrc="https://cdn.jsdelivr.net/npm/filepond/dist/filepond.min.js"></script><script>
const inputElement = document.querySelector('input[type="file"]');
FilePond.registerPlugin(FilePondPluginImagePreview);
const pond = FilePond.create(inputElement, {server: {process: {url: '/api/medias/manage/process',method: 'POST',ondata: (formData)=>{formData.append('share_id',document.querySelector('input[name="share_id"]').value);returnformData;}},revert: '/api/medias/manage/revert/',restore: '/api/medias/manage/restore/',load: '/api/medias/manage/load/',fetch: '/api/medias/manage/fetch/',},chunkUploads: true,chunkForce: true,imagePreviewHeight: 250,imagePreviewMarkupShow: false,credits: false});
</script>
```
and my back-end:
```php
public function process(Request $request, $transferId = null)
{if($request->isMethod('post')){$request->validate(['share_id'=>'required|exists:shares,id']);// Créer un ID unique pour le transfert$transferId=uniqid();$tempPath=storage_path("app/temp/{$transferId}");if(!file_exists($tempPath)){mkdir($tempPath,0777,true);}
return response($transferId, 200)->header('Content-Type','text/plain');}if($request->isMethod('patch')){$request->validate(['file'=>['required'],]);$tempPath=storage_path("app/temp/{$transferId}");if(!file_exists($tempPath)){returnresponse('Transfer ID not found',404);}$offset=$request->header('Upload-Offset');$fileName=$request->header('Upload-Name');$chunkPath="{$tempPath}/chunk_{$offset}";file_put_contents($chunkPath,$request->getContent());$totalLength=$request->header('Upload-Length');$uploadedChunks=glob("{$tempPath}/*.chunk");$uploadedSize=array_sum(array_map('filesize',$uploadedChunks));if($uploadedSize>=$totalLength){$finalPath=storage_path("app/uploads/{$fileName}");$finalFile=fopen($finalPath,'w');foreach($uploadedChunksas$chunk){fwrite($finalFile,file_get_contents($chunk));unlink($chunk);}fclose($finalFile);rmdir($tempPath);returnresponse('File uploaded successfully',200);}returnresponse('',204);// Chunk uploaded}returnresponse('Method not allowed',405);}```### Environment```markdown-Device: Computer-OS: Fedora41-Browser: Firefox132.0
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Have you updated FilePond and its plugins?
Describe the bug
I'd like to set up a chunk file upload. However, Filepond sends PATCH requests to the current page and not to the ‘process’ endpoint.
The first POST request works correctly and I get an Transfer ID from my back-end. However, filepond then sends PATCH requests to the URL on the current page. Shouldn't it send the requests to /process?
Thank you
Reproduction
This is my configuration:
The text was updated successfully, but these errors were encountered: