View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

DFP2 questions

Thread began 5/14/2009 2:11 pm by kbettenc296716 | Last modified 5/17/2009 7:38 am by kbettenc296716 | 3302 views | 17 replies

fragop363190

Ok guys i added delete file behaviors on both update.php and detail.php (carefull it overwrites HelperPHP.php again so keep backup of either the 2 lines code or a file and just rename it on your server).

What was worrying me after checking the delete function is that i don't see anywhere checking the DefaultFileName attribute again so not to delete it. Well code doesn't check about it but its probably not needed on linux servers, on windows u need to hack the code to check about the name.

On linux servers you get an owner on the uploaded files of 99. while if u upload from ftp any file you will get owner of the credentials you used to login to ftp.

DELETE function can not delete the no_image.jpg on my webserver cause it can't delete a file from my user. Can only delete file from user 99. In a windows server environment i suppose u need to hack the above function in HelperPHP.php file

This is the original code in HelperPHP.php

function WA_FileAssist_DeleteFile($folderPath, $filePath){

$folderPath = rootRelativeToFullFileURL($folderPath);
$result = FALSE;
$separator = WA_DFP_GetFileSeparator();
$path = $folderPath.$separator.$filePath;
$fullPath = realpath($path);
if(file_exists($path) && is_writable($fullPath)){
unlink($fullPath);
$result = TRUE;
}
return $result;
}


You should probably change the IF arguement -- if(file_exists($path) && is_writable($fullPath)) -- to :

if(file_exists($path) && is_writable($fullPath) && ($filePath!='no_image.jpg'))

Ofc this is an example. In reality you need to pass to the DELETE function the DefaultFileName value as a parameter and use a variable instead of the hard-coded no_image.jpg. This means that DELETE function needs to change a bit and a parameter specific for it should be adde to code cause e.g. details.php page doesnt have any defaultfilename parameter so the delete function could use.

It is not a tough fix but i don't need it currently as im using a linux webserver. You could also handcode it as i showed u if ur working with images. You dont need loop here, just give the name of the DefaultFileName for no image and IF should check if that is the filename. If it is, it wont bother deleting the file at all.

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...