adam291086 Posted October 29, 2007 Share Posted October 29, 2007 just echo $folder$file with no img scr and see what you get. Making sure the location is correct and that the variables are being passed over. Show me what you get Quote Link to comment https://forums.phpfreaks.com/topic/75084-delete-files-from-directory/page/2/#findComment-380229 Share on other sites More sharing options...
emediastudios Posted October 29, 2007 Author Share Posted October 29, 2007 worked it out Silly me echo "<img src='$folder$file' alt='image' width='150' /><br />"; Quote Link to comment https://forums.phpfreaks.com/topic/75084-delete-files-from-directory/page/2/#findComment-380236 Share on other sites More sharing options...
emediastudios Posted October 29, 2007 Author Share Posted October 29, 2007 now all i got to do is sort out the filedelete.php I was given this code below but nothing, justs timesout <?php $filename = 'gcproperty/images'.$_GET['file']; $file = $_GET['file']; // set up basic connection $ftp_server = "localhost"; $ftp_user_name = "root"; $ftp_user_pass = "5050888202"; $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to delete $file if (ftp_delete($conn_id, $filename)) { echo "<p><center>The file $filen was deleted successfully.<br />"; echo "<center><a href=admin.php>Back</a>"; } else { echo "<p><center>Could not delete $file.<br />"; echo "<center><a href=admin.php>Back</a>"; } // close the connection ftp_close($conn_id); ?> Quote Link to comment https://forums.phpfreaks.com/topic/75084-delete-files-from-directory/page/2/#findComment-380238 Share on other sites More sharing options...
adam291086 Posted October 29, 2007 Share Posted October 29, 2007 You should try and do it yourslef, then you will understand what is going on. What you need to do is add a delete button on the page that displays the image. When this button is clicked then run a delete script. In this script you will need; 1) Sql Delete function, to delete the file out of the database 2) then if the sql delete works then do the unlink(delete) from the directory by using if (@unlink("/images/" .$file)) Quote Link to comment https://forums.phpfreaks.com/topic/75084-delete-files-from-directory/page/2/#findComment-380253 Share on other sites More sharing options...
emediastudios Posted October 29, 2007 Author Share Posted October 29, 2007 Thanks, yeah i will give it a go, i always do, but this project is well overdue and im getting eager to wrap it up as its so close. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/75084-delete-files-from-directory/page/2/#findComment-380269 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.