Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 1 post ] 
coreball
  Thu Nov 24, 2011 7:06 pm
User avatar
Member

Location: Minnesota
I figured it out. Apparently !unlink() doesn't work as well as I anticipated. My current code is less sophisticated than I would like, but it works!

Does anyone here know a good bit about PHP? I am having trouble with unlink(), and am really baffled why my code is not functioning. I am relatively new at PHP programming and any help is appreciated.

When a file is uploaded, the file is moved to the "../uploads/" folder and the following is stored in a MYSQL table: id, date, name, description. The id is an auto increment, the date is curtime(), the name is the file name with extension, and the description is optional text.

The gist of my unlink() code is as follows:

The server checks if the id exists and that it is numeric.
Establishes the MYSQL query into variable $query.
Establishes location of the file to delete in variable $filename.
Checks if the file exists (with $filename), and informs admin if it doesn't.
If the file exists, it prompts admin with a delete confirmation and displays file.
If the deletion is confirmed, the server attempts to unlink $filename.
If the deletion is not possible the admin is informed.
If the file is unlinked, the table entry is erased in the database.

Expand to see the code.


The code processes until the unlink() function, and stops at line 36 (print '<p style="color:red;">Could not delete the photo.</p>';).

Help me HBGames.org. You are my only hope.


Top Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Hosted By: