Example #1
0
    def form_valid(self, form):
        messages.add_message(
            self.request, messages.SUCCESS,
            'Your files have been queued for processing successfully (WIP).')

        upload_model = form.save()
        uploaded_file = form.cleaned_data['upload_file']

        fs = FileSystemStorage()
        fs.base_location = 'uploaded_files'
        saved_file = fs.save(uploaded_file.name, uploaded_file.file)
        upload_model.file_path = fs.location + '/' + saved_file

        if form.cleaned_data['video']:
            video = form.cleaned_data['video']

            fs = FileSystemStorage()
            fs.base_location = 'uploaded_files'
            saved_file = fs.save(video.name, video.file)
            upload_model.video_path = fs.location + '/' + saved_file

        upload_model.save()

        use_case = SpawnPdb2MovieProcessUseCase(upload_model=upload_model)
        use_case.execute()

        return super(UploadView, self).form_valid(form)
Example #2
0
    def post(self, request):
        profile_image = request.FILES.get('profile_image')
        
        # mediaTpye = file_ticket.content_type.split('/')[0]
        directory = settings.MEDIA_ROOT + "/profileImages"
        url = ''

        if profile_image:
            # Storing file for Tickets
            profile_image_name = profile_image.name
            fs = FileSystemStorage()
            fs.base_location = directory
            filename = fs.save(profile_image_name, profile_image)

            url = "http://3.133.98.231:8000/media/profileImages/"+ str(filename)
                
        return Response({'status':True, 'profile_image_path':url,'msg': ""})