[英]how to delete local files from client computer with django
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 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请给我解决方案,用 django 和 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 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请给我解决方案,用 django 和 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 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请给我解决方案,用 django 和 python 删除客户端本地文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.