son.of.the.morning Posted September 8, 2010 Share Posted September 8, 2010 I want to be able to view the contents of a folder in a table, each file having an individual row. The columns would be image name, type, size, and a delete option on the final column. Is this possible to do in php? Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/ Share on other sites More sharing options...
mikosiko Posted September 8, 2010 Share Posted September 8, 2010 Yes Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108710 Share on other sites More sharing options...
turkman Posted September 8, 2010 Share Posted September 8, 2010 im making a image uploading site and the best way i found to do that was to store the image location in a database as it was uploaded. When i want to delete it i just unlink($row['PathToImage']); Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108711 Share on other sites More sharing options...
litebearer Posted September 8, 2010 Share Posted September 8, 2010 might look into http://www.electrictoolbox.com/php-glob-find-files/ Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108712 Share on other sites More sharing options...
son.of.the.morning Posted September 8, 2010 Author Share Posted September 8, 2010 So when an image is uploaded the path is stored inside a database, so i would just have to drag the contence out of the database from another page? Could you explain a litle more about how to delete the file? Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108713 Share on other sites More sharing options...
turkman Posted September 8, 2010 Share Posted September 8, 2010 its simple if you have a file stored at images/filename.jpg and you have that path stored in your database. All you need to do is extract that and simply do unlink($pathtofile); Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108717 Share on other sites More sharing options...
son.of.the.morning Posted September 8, 2010 Author Share Posted September 8, 2010 so if i dragged the file directory from the db and stored it in a varible say for istance $imgDir, and then used unlink($imgDir); it will delete it. Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108723 Share on other sites More sharing options...
turkman Posted September 8, 2010 Share Posted September 8, 2010 it would delete one image at a time, not the whole directory, you would have to post each image path into unlink seperately Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108730 Share on other sites More sharing options...
son.of.the.morning Posted September 8, 2010 Author Share Posted September 8, 2010 do you think it is possible to have check form and use an array in unlink to remove more than one file at a time? Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108733 Share on other sites More sharing options...
turkman Posted September 8, 2010 Share Posted September 8, 2010 yes its possible to use a loop to delete multiple files. Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108734 Share on other sites More sharing options...
son.of.the.morning Posted September 8, 2010 Author Share Posted September 8, 2010 Well ille have a wack at it and hope for the best , thanks allot for the help my good man. Quote Link to comment https://forums.phpfreaks.com/topic/212867-possible-with-php/#findComment-1108739 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.