| Re: XoopsMediaUploader saving file with slashes |
| by onokazu on 2004/1/25 7:04:50 I think this is because of the magic quotes. I have fixed this now on CVS, and will be included in the next package. |
| Re: XoopsMediaUploader saving file with slashes |
| by fatman on 2004/1/25 3:47:31 I provided a work around by just renaming the file to a random number. And then called the targetFileName. here is my modified code below in case anyone is interested. le="color: #000000"><?php $file = $_FILES[$form_field_name]['name']; $n = explode('.', $file); $target_file = $time().".".$n[1]; // 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); $uploader->setTargetFileName($target_file); if ($uploader->fetchMedia($form_field_name)) { if (!$uploader->upload()) .... continued
|
| XoopsMediaUploader saving file with slashes |
| by fatman on 2004/1/25 3:16:40 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.jpg obviously 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? le="color: #000000"><?php function setTargetFileName($value){ $this->targetFileName = strval(trim($value)); } Here is a snippet of my own code in case it helps. le="color: #000000"><?php // 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; }
|