I am currently working on a new project, using Codeigniter, it is my first experience and I do not find great help, I want the user to delete a photo chosen by him from his folder, The controller: '
public function delete()
{
delete_files('C:\wamp64\www\uploads\_back');
}'
A view: '
{imagesback}
<div class="col-sm-2">
{ver}
<img src="{path}" style="width: 100%; height: 100px;">
<p>{name}</p>
<button name="nameimagetodelete" onclick="do_delete('{name}')"></button>
</div>
{/imagesback}
'
and JavaScript '
script type="text/javascript">
function do_delete(name){
var r = confirm("You sure?");
if (r == true)
{
window.location.href = "<?php echo site_url('admin/delete');?>?name="+name;
}
else
{
x = "Action canceled";
alert(x);
}
}
</script>
'
Thank you in advance!