Pure PHP Upload 2 Support Product Page

Deleting a Filename from a specific SQL Path Value

Asked 28 Jun 2010 23:11:02
1
has this question
28 Jun 2010 23:11:02 Simon Rostron posted:
Hi Support , first I would like to say I love your extensions they have saved me hours of work and they are all working great.

Im having a tiny little trouble deleting files from my directory as the 'file path' is different for each SQL Row. On the upload the server creates a directory like this /MM/YYYY format and then saves the filenamePath in the SQL Row. So the file structure looks like this

/storage/062010/filename.jpg
/storage/path/filename

Looking at your script you have this variable

$dbr = new deleteFileBeforeRecord();
$dbr->path = "images";

I need to change this so it retrieves the filenamePath and filename from the SQL Select. I have tried using a $_GET and it does not work. I thought something like this would work...

$path = $_GET['path'];

But it doesn't seem to get the variable...Register_Globals is on as it is deleting the SQL record but not the images..


Any advice would be great , I would just use one directory but the volume of files is going to be in the 10,000 so sub-folders is my preference.

Thanks
Simon




Edited by - Simon Rostron on 28 Jun 2010  23:11:28

Replies

Replied 01 Jul 2010 10:59:15
01 Jul 2010 10:59:15 Miroslav Zografski replied:
Hello Simon,

The rename before record script is called when the form is submit. You can try following:
Set the

$dbr->path = $_POST['path'];


and set in the form a hidden input with a

value="<?php $_GET['path'];?>"


and make sure that you are passing a path that has slash in the end : "storage/path/"

Regards,

Reply to this topic