-
Notifications
You must be signed in to change notification settings - Fork 0
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
add chunked uploads to the postman api description #70
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with a file chunked by the Transmorpher Client backend.
Nice and easy addition to the postman file!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with newest postman v11.28.0. works without auth for upload.
1b6c3d1
to
2b2f395
Compare
These examples allow uploading chunks from Postman to the Transmorpher server.
The following code proved useful in debugging this. Some vendor object properties may have to be set to public for this to work.
The main learning was that the filenames of chunks need to be identical when using a tool like Postman.
UploadSlotController
` public function receiveFile(UploadRequest $request, UploadSlot $uploadSlot): JsonResponse|UploadedFile
{
# DEBUG
$uploadSlotIdentifier = $uploadSlot->token;
$requestArray = $request->toArray();
$chunkNumber = $requestArray['dzchunkindex'] ?? $requestArray['chunkNumber'] ?? 'wtf';
Storage::disk()->putFileAs('', $request->file('file'), sprintf('uploadedChunk_%s_%s', $uploadSlotIdentifier, $chunkNumber));
######
` protected function saveFile(UploadedFile $uploadedFile, UploadSlot $uploadSlot, MediaType $type): JsonResponse
{
# DEBUG
Storage::disk()->putFileAs('', $uploadedFile, 'uploadedFile.mp4');
#####
`