close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete file not working

Thread began 5/04/2015 10:30 am by Armen | Last modified 5/04/2015 2:40 pm by Ray Borduin | 2484 views | 10 replies |

Armen

Delete file not working

I'm attempting to delete a file before I delete the associated record. The file is in a folder outside of the site root. The file is not being deleted.

<?php
$WA_DeleteFileResult1 = false;
if("" == ""){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("/home/cvoffers/_form", "".$row_rsForm['formFile'] ."");
}
?>
<?php
// WA Application Builder Delete
if ("" == "") // Trigger
{
$WA_connection = $connData;
$WA_table = "listingForm";
$WA_redirectURL = "cp.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "formID";
$WA_columnTypesStr = "none,none,NULL";
$WA_fieldValuesStr = "".$_GET['formID'] ."";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_comparisions = explode("|", $WA_comparisonStr);
$WA_connectionDB = $database_connData;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$deleteParamsObj = WA_AB_generateWhereClause($WA_fieldNames, $WA_columns, $WA_fieldValues, $WA_comparisions);
$WA_Sql = "DELETE FROM `" . $WA_table . "` WHERE " . $deleteParamsObj->sqlWhereClause;
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}?>

Sign in to reply to this post

Ray BorduinWebAssist

Two things:

1) make sure the recordset is above this code
2) add a slash to the end of the folder name like:
WA_FileAssist_DeleteFile("/home/cvoffers/_form/", "".$row_rsForm['formFile'] ."");

Sign in to reply to this post
Did this help? Tips are appreciated...

Armen

I ensured the recordset is above the code and added the slash after the folder. Still no luck. See code in private section.

Sign in to reply to this post

Ray BorduinWebAssist

Try adding this after the recordset and before the delete:

php:
die("/home/cvoffers/_form/"."".$row_rsForm['formFile'] ."");



See if it looks like the correct path... that will tell you if the issue is in the delete server behavior or the filtering of the recordset above it.

Sign in to reply to this post
Did this help? Tips are appreciated...

Armen

Like this? This gives me a syntax error in Dreamweaver.

Sign in to reply to this post

Armen

See file structure below...

Sign in to reply to this post

Ray BorduinWebAssist

Sorry I had a comma in place of a period in the code sample... you put it in the right spot, should be:


<?php die("/home/cvoffers/_form/" . "".$row_rsForm['formFile'] ."");?>

Sign in to reply to this post
Did this help? Tips are appreciated...

Armen

Here's the result

Sign in to reply to this post

Armen

This post has been deleted.

Armen

I have a feeling that this is due to the fact that the file I'm wanting to delete is outside the site root...

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...