|
| ||||||||||
| Tags: php |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Php Action unlink function
Anyway, back to the file management. I would prefer that the management is possible by means of clicking a small image (of a cross, etc., but iig an image) the files to delete. Well I know you with php unlink a file can delete, but my question is how I unlink function that plate coupling. I tried with onclick, but I was not (though the chance is very great that I have done something wrong). Who can explain to me how it should? The code that generates the list is sufficient: Code: Quote:
It must be behind that </ a> too. Has anyone an idea? |
|
#2
| ||||
| ||||
| Re: Php Action unlink function
a <a> around a <img> locations, and in that link you call for example delete.php? = file, and then you just put $ file. And in delete.php do you first check whether the file exists, and whether the file is (otherwise you can just delete everything from your server), and whether the user has rights to that file correctly. If so, then unlink () apply. |
|
#3
| ||||
| ||||
| Re: Php Action unlink function
If the link to delete.php? File = 123456 link. Then would it be to you in a database file with the ID 123456. You look what file it is and you removed the file and the corresponding record from the database. Of course you may disconnect some controls in order to see if the user calls delete.php the rights to that specific file to delete. Your ID can be replaced by the file if necessary. But I would surely think very carefully about the security of this action. |
|
#4
| |||
| |||
| Re: Php Action unlink function
I am not a PHP hero, but what you have got the script is only displaying the list of files in the upload folder. How do you delete a file I do not know, but I would deal with one type of form or an action link when you are on a link (which may be an image). The link would include as Civil mentions delete.php? File = 123456. You have a "delete.php" file that performs the above checks (there is a file and you have rights to delete etc.). The link (a href = "delete.php? File = 123456") so to (leave) to call a value from the "file" table in your database (if you use it), this can read with a $ _GET [ 'file'] in delete.php. Delete.php Quote:
With an echo / print of '$ filename' will result in the following text: Quote:
How do you then work to make sure the file exists and how to remove them you will still have other questions. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Php Action unlink function" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c++ equivalent function to the c-function 'sprintf | Dilbert | Software Development | 6 | 13-12-2011 03:03 PM |
| c# function equivalent to gettime function in javascript | Omaar | Software Development | 4 | 10-03-2010 09:44 PM |
| How to pass function with parameters to another function in PHP? | Linoo | Software Development | 5 | 27-02-2010 06:52 PM |
| How does abstract function differs from virtual function? | Maddox G | Software Development | 5 | 29-01-2010 10:32 AM |
| Function keys don't function under windows XP | GunFighter | Hardware Peripherals | 3 | 08-04-2009 11:07 PM |