I have used the file type to create a custom attribute. The file has been successfully updated in the admin portal lead form. however, while utilising the embed web form, the file has not been uploaded but, rest all field were updated. Kindly advice me to fix this issue.
I have tried to modify Ajax code too, but not working.
Hello.
I have used the file type to create a custom attribute. The file has been successfully updated in the admin portal lead form. however, while utilising the embed web form, the file has not been uploaded but, rest all field were updated. Kindly advice me to fix this issue.
I have tried to modify Ajax code too, but not working.
Ajax code path: packages/Webkul/WebForm/src/Resources/views/settings/web-forms/form-js.blade.php
Ajax code:
` $("#krayinWebForm").validate({ submitHandler: function(form) {
Path: packages/Webkul/Attribute/src/Repositories/AttributeValueRepository.php
if ($attribute->type === 'image' || $attribute->type === 'file') { try { if (request()->hasFile($attribute->code)) { $file = request()->file($attribute->code); if ($file->isValid()) { $data[$attribute->code] = $file->store($data['entity_type'] . '/' . $entityId); } else { throw new \Exception('Uploaded file is not valid.'); } } else { $data[$attribute->code] = null; } } catch (\Exception $e) { Log::error('File upload error: ' . $e->getMessage()); $data[$attribute->code] = null; // Handle file upload error gracefully } }
Thanks!