S3 File Validation #653
Replies: 3 comments
-
Hey @ericjanofski are you validating what kind of field, an upload field or an image field ? In case of image you need to use an external library to validate base64. I've given you directions in your other issue . I've planned to release a separate package with image validation using the package I mentioned (https://github.com/crazybooot/base64-validation). We can't add a dependency in the core just for this use-case, so we need to do it separatelly in a different (optional) package. Let me know if that's not the case. Cheers |
Beta Was this translation helpful? Give feedback.
-
@pxpm it's an image field. I'm using the base64 validation as well. That works great, but if I load a page in PageManager that has an image already in the field and I hit save, the errors fly even though the file is properly set (stored on s3). Here is my rule: Even though it validated when I uploaded the file, and it's a jpg, and it's marked as sometimes, resaving the page gives me this: |
Beta Was this translation helpful? Give feedback.
-
I would think after the file is saved the input shouldn't be there at all. That would allow the 'sometimes' rule to work. Removing the image with an X could bring back the input and re-trigger the rule requirement. Or I'm doing something wrong! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Wondering if I can get some assistance. I'm attempting to validate an image's mime type and file size before uploading to s3, but the validator doesn't seem to work properly.
MIME TYPE ISSUE
I have a request file setup with the following rule:
public function rules()
{
return [
'image' => ValidUpload::field('required')->file('mimes:png'),
];
}
But after attempting to upload a png I see a validation error: The image field must be a file of type: png.
FILESIZE ISSUE
Also, I cannot find where to limit the upload filesize. If I use "size" in the validation rule it gives a message about the fields character length.
Beta Was this translation helpful? Give feedback.
All reactions