Gamerz Posted July 11, 2009 Share Posted July 11, 2009 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? Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 11, 2009 Share Posted July 11, 2009 Both of these are possible. I'm trying to predict your next question now Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 11, 2009 Author Share Posted July 11, 2009 Well can you help me with coding of those? And yes, did you predict my above question? Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 11, 2009 Share Posted July 11, 2009 Oh boy, I'm so good at predicting! 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. Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 11, 2009 Author Share Posted July 11, 2009 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. Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 11, 2009 Share Posted July 11, 2009 Show us what you got. Show us what you're tried. Tell us what problems you have. This is how you get helped here Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 11, 2009 Author Share Posted July 11, 2009 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... Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 11, 2009 Share Posted July 11, 2009 Ok.. start with a script to upload a file. There are many tutorials for that. Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 11, 2009 Author Share Posted July 11, 2009 I already have a file uploader though.... Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 11, 2009 Share Posted July 11, 2009 So you've got something. To calculate an md5 hash of a file use md5_file function. See if you can store this hash into a database along with a path to the file. Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 11, 2009 Author Share Posted July 11, 2009 Well my file uploader doesnt have anything to do with mysql's...so how do I get the hash? It's all php based Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.