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

الرفع متعدد الأجزاء (Multipart uploads)

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

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

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

في هذا الدرس

accept a file in a request.

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

  • Browsers and clients upload files with multipart/form-data: the body has several named parts, each with its own headers.
  • In Spring, bind a file part with @RequestPart or @RequestParam of type MultipartFile.
  • MultipartFile gives the original name, content type, size, and a stream of bytes.
  • Other form fields can arrive in the same request.
  • Test with curl -F "file=@pen.png".
تفاصيل المخطط المبدئي

عرض عملي

java
@PostMapping(value = "/products/{id}/images", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
ResponseEntity<ImageResponse> upload(@PathVariable long id, @RequestParam("file") MultipartFile file) { ... }

اختبر فهمك

Which content type carries file uploads?

أظهر الإجابة

multipart/form-data.

التطبيق

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

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

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

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