I have created employee crud in which I am storing the image as well, which is working fine when we want to create new employee but in when editing the existing employee it is forcefully asking to upload the image
Loading
I have created employee crud in which I am storing the image as well, which is working fine when we want to create new employee but in when editing the existing employee it is forcefully asking to upload the image
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Oct 25, 2024, 4:23 AM EDT
Helli,
While edit employee you need to prefill your existing iamge to your model. Hope this will help you to troubleshoot your issue.
Vijay Pratap SinghRank #381 · 6.6K reputationPosted Oct 25, 2024, 3:16 AM EDT
Hello Saif, Can you please send more details how and where you are storing your image during create new employee.
Thanks
Vishal YelveRank #178 · 13.6K reputationPosted Oct 25, 2024, 8:09 AM EDT
Hi Saif,
I agree with Jignesh's solution. you need to pull the image in your edit model.
Asma KhalidRank #160 · 14.7K reputationPosted Nov 1, 2024, 4:04 AM EDT
In edit mode, you need to fill all the mandatory fields data that are marked required or non-nullable within your ViewModel either with directly editables firlds or hidden fields. In case of image, you need hidden field hold existing image path in case user does not edit the image.
Aman GuptaRank #193 · 12.4K reputationPosted Oct 25, 2024, 7:21 AM EDT
Hi Saif,
I believe u had not made the Image object as Nullable=true by default it is also false, this is the reason it is asking for image when u edit employee.
If u can share the code it would be helpful
thanks