Jump to content

Adding a killcode on files for a file uploader


Gamerz

Recommended Posts

Hi, is it possible, that when someone upload's a file to my server, they will automatically get a killcode so that if they want to delete a file, they can follow a killcode link, so the file can be deleted...

 

Another way, if possible is that to place a search function in the whole uploads directory and the user can search there own file and choose to delete it...is that possible?

Oh boy, I'm so good at predicting! :D

 

I am not going to write the code for you, I can give you some hints however ;)

 

You could try along these lines:

1. Once the upload is completed, files md5 hash is calculated using md5_file.

2. The hash and the path to file are stored into the database

3. The user is presented a url to 'delete file' page with hash attached as 'fileID'

like this: http://mydomain.com/deletefile.php?fileID=1234567890abcdef1234567890abcdef

4. deletefile.php script takes 'fileID' from $_GET variable, searches for same hash in the database, and deletes the file from associated path.

 

On second thought, the hash should probably be generated from file contents AND some user specific data. There's a possibility that two users upload same file.

I got nothing unless I have something in hand..like a tutorial maybe? I can't code like you guys....and I don't even know how to generate a md5 hash for a file..but I do know GET methods, and how to GET the hashes..but other than that, I'm dead ended, man...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.