This topic is locked

trouble with $files_move

11/20/2010 1:11:00 PM
PHPRunner General questions
A
aptivus author

Hi everyone,

I was trying to write a function in the Before Record Added event in an add page

in order to upload a file and change its name.

I had trouble with the array $files_move.

I successeeded with this one:

if($_FILES["value_img_logo_1"]["tmp_name"])

{

$_FILES['value_img_logo_1']['name'] = time();

$immagine_utente = $_FILES['value_img_logo_1']['name'];
if(move_uploaded_file($_FILES['value_img_logo_1']['tmp_name'], "../profiles/produttori/".$_FILES['value_img_logo_1']['name']))

{

chmod("../profiles/produttori/".$_FILES['value_img_logo_1']['name'],0777);

}
}


As you can see I used "brute force" to get the input file name from the add page.
How could i make the same thing with $files_move?
Thank you
Francesco

Sergey Kornilov admin 11/22/2010

Francesco,
if you use PHPRunner 5.3 check this article that explains how to deal with uploaded files:

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

A
aptivus author 11/22/2010



Francesco,
if you use PHPRunner 5.3 check this article that explains how to deal with uploaded files:

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


Sorry, I use 5.2 and must complete this project using only 5.2.

I do not want to risk failures by switching to 5.3
Francesco

Sergey Kornilov admin 11/22/2010

In version 5.2 you can use $files_move variable. You can find sample in PHPRunner 5.2 manual under Advanced topics->Events->Sample events->Upload.