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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Oh boy, predict my future, physic!

 

Lol...Well, is there any tutorial I can follow to start this?

 

Because I am only a beginner at php, and have no way to code..unless I have a tutorial...I tried google, but they arent helpful.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.