This topic is locked

uploaded filenames are causing problems

6/27/2012 9:39:47 PM
PHPRunner General questions
W
wfcentral author

I am using PHPRunner 6.1 (build 11708).
I built a system for a client where his employees can upload receipts as jpg files.
They are using names like "Dinner with Bill & John.jpg"
The files will not show up in PHPRunner because of the spaces and the & sign.
How do I fix this so it will either accept files named like that OR rename them (files) and rename them in the database.

Sergey Kornilov admin 6/27/2012

You can do both renaming and file name validation in BeforeAdd event. Check this article for inspiration:

http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm

W
wfcentral author 6/27/2012



You can do both renaming and file name validation in BeforeAdd event. Check this article for inspiration:

http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm'>http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm


my ID is a key so I changed the $values to $keys as listed in the instructions at http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm'>http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm
global $pageObject;
foreach( $pageObject->filesToMove as $key=>$val)
{
if($pageObject->filesToMove[$key]->sourceFilename==$_FILES["valueFieldName".postvalue("id")]["tmp_name"])
$pageObject->filesToMove[$key]->destFilename= $keys["id"].".jpg";
}
$keys["filename"] = $values["ID"].".jpg";
I got this error back
"undefined variable: keys"

Sergey Kornilov admin 6/29/2012

Make sure you add this code to correct event where $keys array is defined.
Also $keys["filename"] doesn't make sense if "filename" is not a key column.
If you need more help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.