Hi all,
need some directions, i need direction replacing file with newly uploaded
file. The upload function is working but i want to replace a file every
time i upload a new one.


my model.py

class uploadfile(models.Model):
    description = models.CharField(max_length=255, blank=True)
    Select_File=models.FileField(upload_to='/var/www/projects/webapp/media')
    uploaded_at =models.DateTimeField(auto_now_add=True)


my view.py

def uploadfunc(request):
    if request.method=='POST':
        form =uploadfileform(request.POST,request.FILES)
        if form.is_valid():
            form.save()
            return render_to_response('upload_successful.html')
    else:
        form=uploadfileform()
    return render(request, 'upload.html',{'form':form})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y4PfafDi-2fUhMdjP9KhRuahdTbD3sy64b8PbQjx%3D0HVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to