PDA

View Full Version : Delete images



Ini
26-10-2006, 10:21 AM
okay right so now i have made my folio system and i suck at mySQL

if thats what it even is Lol.

Anyway i have the images, an admin panel and the upload script.

Now i need the code to be able to delete them.

they do not save to the database

They save to a folder on cPanel.

+rep for any help.

dp_124
26-10-2006, 10:47 AM
<?
unlink("link to file.gif");
?>


Is that what you want?

Ini
26-10-2006, 11:00 AM
unlink = delete?

And what would i put instead of file.gif? so that it automatically detects the image i want to delete?

:Blob
26-10-2006, 02:19 PM
If you had a form you could use

$file = $GET_['file'];

unlink($file);

Ini
26-10-2006, 02:52 PM
i have got an upload form, as its a folio system?

How would i make that a link?

Ini
27-10-2006, 07:16 AM
Sorry to bump but i need help

dp_124
27-10-2006, 10:17 AM
You could enter the name of the file into a form, or you could make each image have a delete hyperlink, which then has a GET variable with the file name in.

George Morgan
27-10-2006, 10:58 AM
<?
$file = $_GET[file];
unlink("$file");
?>
Save that as delete.php

Then go to http://www.yourwebsite.com/delete.php?file=images/image.gif

:Blob
27-10-2006, 05:16 PM
You would nead to have a user system to define if your a admin as I could easily delete your site.

Dentafrice1
28-10-2006, 04:06 AM
Make an upload form to submit the picture name into the database and upload to a directory.

Then just get a dropdown to pull all the image names from the database.

Hit submit and that name will insert into the unlink function.

Not hard at all ;)

Want to hide these adverts? Register an account for free!