I have a single input field with the 'multiple' attribute that allows users to upload images. However, I want to restrict the number of images that can be uploaded to three. Additionally, I'd like each uploaded image to be inserted into a separate column in the database, where I have columns named 'firstimg,' 'secondimg,' and 'thirdimg.'
Moreover, I want these uploaded images to be transferred to a folder named 'accountimages'. How can I achieve this functionality in my web application?
<form action="submit_upload.php" method="post" enctype="multipart/form-data">
<label for="multiple-imgs" id="multiple-imgs-label">
<input type="file" class="multiple-imgs" id="multiple-imgs" name="multiple-imgs[]" accept="image/*"
multiple hidden>
<div id="multiple-imgs-view">
<img src="icon.png" id="icon-img">
</div>
</label>
<div class="submit-btn-container">
<button type="submit" class="submit-btn" id="submit-btn" name="submit-btn">Submit</button>
</div>
</form>
I've been exploring various approaches to implement this feature in my web application, but I haven't been successful so far.
I was expecting that I could find a solution to limit the image uploads to three, insert them into separate database columns ('firstimg,' 'secondimg,' and 'thirdimg'), and also transfer these images to a folder named 'accountimages'.
source https://stackoverflow.com/questions/77207953/how-can-i-upload-three-images-as-a-limit-to-the-database-each-image-to-separate
No comments:
Post a Comment