انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-023-L02

الحدود والتحقق

  • الدرس 2 من 6
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

reject files that are too big or the wrong kind.

الموضوعات المخطط لها

  • Set size limits in configuration (spring.servlet.multipart.max-file-size and max-request-size); verify property names for your version.
  • An oversized upload gives 413 Content Too Large (verify wording) or a mapped error; handle it with a clear message.
  • Check the declared content type against an allow-list (image/png, image/jpeg), and reject empty files.
  • The declared type can lie; for stronger checks, inspect the first bytes (file signature) before accepting.
  • Return 400 or 415 for wrong type, with a Problem Details body.
تفاصيل المخطط المبدئي

عرض عملي

yaml
spring.servlet.multipart.max-file-size: 5MB
spring.servlet.multipart.max-request-size: 6MB

اختبر فهمك

Why check size in configuration?

أظهر الإجابة

So huge uploads are stopped early.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.