We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,011 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Online Storage App - Deleting Files

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

2
Contributors
1
Reply
12 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
suhaildawood
Newbie Poster
18 posts since Feb 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
<?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.

mathieu89
Light Poster
37 posts since Nov 2010
Reputation Points: 24
Solved Threads: 4
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0547 seconds using 2.65MB