This topic is locked

work with files to upload

12/15/2011 2:08:48 PM
PHPRunner General questions
A
auez author

Hi, I need to work a txt file before save it in server folder, when I use before add record event I don't know how i can open it with php file function because the file isn't saved and the field value don't contains the full path to original folder (like /My documents), less than if i use timestamp adding to file name.

I use this in before add record event:

global $pageObject;

$archivo=$values["archivo"]; <= field value

foreach( $pageObject->filesToMove as $key=>$val)
{
if($pageObject->filesToMove[$key]->sourceFilename==$_FILES["valuearchivo"]["tmp_name"])
$pageObject->filesToMove[$key]->destFilename= $values["AFIP"];
}
$archivo= file($values["AFIP"]); <== here I have an error "file(../afip/afip-20111215-125857.txt) [function.file]: failed to open stream: No such file or directory"
// iniciamos contador y la fila a cero
$lineas = count($archivo);

$errores=0;

$err="";

for($i=0; $i < $lineas; $i++)

{

$registro=$archivo[$i];

.......

C
cgphp 12/15/2011

The file will be available to be opened in the "After record added" event.