s3 image file validation
This commit is contained in:
@@ -11,6 +11,7 @@ import LocationForm from "../components/LocationForm";
|
||||
import DeliveryOptions from "../components/DeliveryOptions";
|
||||
import PricingForm from "../components/PricingForm";
|
||||
import RulesForm from "../components/RulesForm";
|
||||
import { IMAGE_LIMITS } from "../config/imageLimits";
|
||||
|
||||
interface ItemFormData {
|
||||
name: string;
|
||||
@@ -346,9 +347,8 @@ const EditItem: React.FC = () => {
|
||||
const handleImageChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const files = Array.from(e.target.files || []);
|
||||
|
||||
// Limit to 5 images total
|
||||
if (imagePreviews.length + files.length > 5) {
|
||||
setError("You can upload a maximum of 5 images");
|
||||
if (imagePreviews.length + files.length > IMAGE_LIMITS.items) {
|
||||
setError(`You can upload a maximum of ${IMAGE_LIMITS.items} images`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user