Hello,

I am really new to PHP, so sorry if this is way too basic. I followed this tutorial: http://net.tutsplus.com/tutorials/php/online-file-storage-with-php/ and I created a simple online storage app for my website. How would I be able to make it so that I can delete the stored files?

Thanks

<?php $name=$_GET['name'];
$target = "../upload/$name"; 
$myFile = $target;
unlink($myFile);

This is a piece of code that i have used once before. In this case i have got the file name after it was posted to the url. The unlink part is the bit where it deletes the file.

Make sure you use proper security. In this case the user could potentially change the url from .php?name=file1 to .php?name=file2 and therefore delete file2 aswell.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.