hello i am trying to make a file deleter, that when you specify the file adress and submit, that file would be deleted. worked great on localhost but when i uploaded to server and run it was not working.. the logic is simple it is only deleting files from server not from client computer. pls give me a solution for this?
html
<form action="" method="post">
{% csrf_token %}
<input type="text" name="adress" id="url">
<button type="submit">delete</button>
<button onclick="edit()" type="button">edit</button>
</form>
<script>
function edit(){
let inp = document.getElementById('url')
let val = document.getElementById("url").value;
let raw = val.replaceAll('\\',"\\\\")
inp.value = raw;
console.log(inp.value)
console.log('\\')
}
views
def delete(request):
if request.method == "POST":
adress = request.POST['adress']
shutil.rmtree(adress)
return redirect('/success')
else:
return render(request,'file_deleter_app/home.html')
def page(request):
return HttpResponse("success")
pls give me solution to delete client local files with django and python
hello i am trying to make a file deleter, that when you specify the file adress and submit, that file would be deleted. worked great on localhost but when i uploaded to server and run it was not working.. the logic is simple it is only deleting files from server not from client computer. pls give me a solution for this?
html
<form action="" method="post">
{% csrf_token %}
<input type="text" name="adress" id="url">
<button type="submit">delete</button>
<button onclick="edit()" type="button">edit</button>
</form>
<script>
function edit(){
let inp = document.getElementById('url')
let val = document.getElementById("url").value;
let raw = val.replaceAll('\\',"\\\\")
inp.value = raw;
console.log(inp.value)
console.log('\\')
}
views
def delete(request):
if request.method == "POST":
adress = request.POST['adress']
shutil.rmtree(adress)
return redirect('/success')
else:
return render(request,'file_deleter_app/home.html')
def page(request):
return HttpResponse("success")
pls give me solution to delete client local files with django and python
hello i am trying to make a file deleter, that when you specify the file adress and submit, that file would be deleted. worked great on localhost but when i uploaded to server and run it was not working.. the logic is simple it is only deleting files from server not from client computer. pls give me a solution for this?
html
<form action="" method="post">
{% csrf_token %}
<input type="text" name="adress" id="url">
<button type="submit">delete</button>
<button onclick="edit()" type="button">edit</button>
</form>
<script>
function edit(){
let inp = document.getElementById('url')
let val = document.getElementById("url").value;
let raw = val.replaceAll('\\',"\\\\")
inp.value = raw;
console.log(inp.value)
console.log('\\')
}
views
def delete(request):
if request.method == "POST":
adress = request.POST['adress']
shutil.rmtree(adress)
return redirect('/success')
else:
return render(request,'file_deleter_app/home.html')
def page(request):
return HttpResponse("success")
pls give me solution to delete client local files with django and python
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.