MySQL uploading and deleting

sub-spaced

Registered
Hi all,

Does anybody out there know how to delete files that have been uploaded through php.

I am currently making a content management site where the owner can upload thumbnails and larger images through an admin side of the site on to a server.

The file names and paths are stored on a database, once the upload has been completed, the problem is when it comes to removing those image files (not the database paths, I can do that) when they are not needed any more so that the server space does not become full.

I would be greatful if anybody can help me out with this.http://www.macosx.com/forums/images/icons/icon7.gif
 
why dont use the unlink function???

try it

PHP:
<?PHP

if (unlink("myfile.jpg")) {
   echo "the file had been deleted succefully";
}
else {
  echo "The file had no been deleted";
}
?>

if u cant delete it, maybe u have a permision problems in the folder where u r storing u images. I set the permisions with the terminal. And example.

Last login: Thu Dec 4 12:41:22 on ttyp1
Welcome to Darwin!
[guille:~] andreaarango% ftp bellecuisinestore.com
Connected to bellecuisinestore.com.
220 ProFTPD FTP Server ready.
Name (bellecuisinestore.com:andreaarango): cusine#bellecuisinestore.com
331 Password required for cusine#bellecuisinestore.com.
Password:
230 User cusine#bellecuisinestore.com logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd mainwebsite_html/v1
250 CWD command successful.
ftp> ls -l
227 Entering Passive Mode (200,57,37,248,143,2).
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 cusine cusine 4096 Dec 3 23:44 imagenes
-rw-r--r-- 1 cusine cusine 1349 Dec 2 19:17 index.html
-rw-r--r-- 1 cusine cusine 69377 Dec 4 17:32 index.swf
drwxr-xr-x 2 cusine cusine 4096 Dec 2 19:14 panel
drwxr-xr-x 2 cusine cusine 4096 Dec 2 19:14 php
drwxr-xr-x 2 cusine cusine 4096 Dec 2 19:15 swf
226 Transfer complete.
ftp> chmod 777 imagenes
200 SITE CHMOD command successful.
ftp>

look where I have a the bold font, is where u must write the commands.

the first specified the host name
the second the login name
3 .- The password
4 .- The path where is my image folder
5 .- The command ls -l display the directories and files where I am
6 .- Finally, I set up the permisions in my folder "imagenes"

If u have some problems with the unix commands, read the UNIX FAQ.


bye bye
 
Back
Top