Editable submission File input support (#120)

This commit is contained in:
Chirag Chhatrala
2023-04-26 20:35:02 +05:30
committed by GitHub
parent 3f2fe352e8
commit e165242e57
4 changed files with 44 additions and 4 deletions

View File

@@ -136,6 +136,13 @@ class StoreFormSubmissionJob implements ShouldQueue
return $finalData;
}
// This is use when updating a record, and file uploads aren't changed.
private function isSkipForUpload($value)
{
$newPath = Str::of(PublicFormController::FILE_UPLOAD_PATH)->replace('?', $this->form->id);
return Storage::disk('s3')->exists($newPath.'/'.$value);
}
/**
* Custom Back-end Value formatting. Use case:
* - File uploads (move file from tmp storage to persistent)
@@ -150,6 +157,10 @@ class StoreFormSubmissionJob implements ShouldQueue
return null;
}
if($this->isSkipForUpload($value)) {
return $value;
}
$fileNameParser = StorageFileNameParser::parse($value);
// Make sure we retrieve the file in tmp storage, move it to persistent