이미지업로드1 [django] input[type=file] 을 이용하여 첨부한 파일 저장 views.py import os def programdetailupdate(request: HttpRequest, pk: int) -> HttpResponse: std = Program() srd = Program.objects.get(id=pk) std.pk = pk if request.FILES['pimg']: uploaded_file = request.FILES['pimg'] file_name = uploaded_file.name # 현재 날짜 가져오기 curdt = datetime.now() curdty = curdt.year curdtm = curdt.month curdtd = curdt.day mloc = f'laboratory/program/{curdty}/{curdtm}/{curdtd}'.. 2023. 5. 11. 이전 1 다음