remove uploaded data from database and files from server

Re: [ht1080z] remove uploaded data from database and files from server

By Jason - December 19, 2011

Hi,

Here is one approach you can take.

First, you have the "delete" link re-load the current page with the record num of the upload record in the url string like this:

<?php foreach ($accomRecord['acc_photos'] as $upload): ?>
<li>
<a href="<?php echo $upload['urlPath'] ?>" rel="prettyPhoto">
<img src="<?php echo $upload['thumbUrlPath'] ?>">
</a>
<ul class="action-list">
<li>
Actions
</li>
<li>
<a href="<?php echo $upload['urlPath'] ?>" rel="prettyPhoto">view</a>
</li>
<li>
<a href="?removeUpload=<?php echo $upload['num'];?>">delete</a>
</li>
</ul>
</li>
<?php endforeach ?>


Then, near the top of your page (before any getRecords call), you can remove the upload like this:

if (@$_REQUEST['removeUpload']) {
removeUploads("num = '".mysql_escape($_REQUEST['removeUpload'])."'");
}


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] remove uploaded data from database and files from server

Hello Jason!

Thank you for your quick response and solution!

Another one with the same picture gallery.
Side by the pictures i put text input to get information (titles) for the images from the users.
How can i update the uploads table with these array information?
Can i create $query for each record to update the info1?

Please advise,
Karls

Re: [ht1080z] remove uploaded data from database and files from server

By Jason - December 20, 2011

Hi,

Yes, if you can create a MySQL UPDATE query for any given record, using that records num field as a unique identifier.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/