1
Hi I making use of a the /class/uploader.php file to assist with an image upload for a module I'm working on.
If I upload a file which has a single quote such as
image'name.jpg the file gets saved as
image\'name.jpgobviously the uploader is adding slashes for database insertion into the database. However this creates a lot of issues when trying to delete the file or change its properties via FTP or another such method. My FTP sees the file as having a prohibitted name.
Is their a reason why the file is saved with slashes? Couldn't these be added purly for storage in the database.
I'm guessing that this bit of code found in uploader.php lets me suggest a target file name. If this is correct, could someone explain to me how to engage it?
function setTargetFileName($value){
$this->targetFileName = strval(trim($value));
}
Here is a snippet of my own code in case it helps.
// Include the XOOPS uploader class
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
// create an instance of the uploader and provide settings
$uploader = new XoopsMediaUploader($org_path, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($form_field_name))
{
if (!$uploader->upload())
{
echo $uploader->getErrors();
} else {
$uploader->getSavedDestination();
// Capture info about the file save
$saved_file = $uploader->getSavedFileName();
$full_path = $uploader->getSavedDestination();
print $saved_file;
}
} else {
echo $uploader->getErrors();
return;
}