[SOLVED] Changing uploaded file name - not work |
3/3/2010 4:34:55 PM |
PHPRunner General questions | |
H
horsey_kim author
I am trying to get this to work from this page; http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm |
|
![]() |
Sergey Kornilov admin 3/3/2010 |
keys array is only available in AfterAdd event. In BeforeAdd event record is not created yet which means there is no key. |
H
|
horsey_kim author 3/5/2010 |
keys array is only available in AfterAdd event. In BeforeAdd event record is not created yet which means there is no key.
To rename upload files based on ID field use the following code in Add page: Before record added and/or Edit page: Before record updated events. Note: Change the values listed in red to match your specific needs. global $files_move; foreach( $files_move as $key=>$val) { if($val[0]==$_FILES["file_FieldName"]["tmp_name"]) $files_move[$key][1] = "files_folder/".$values["ID"].".jpg"; } $values["FieldName"] = $values["ID"].".jpg"; In this example FieldName and ID are actual field names, files_folder is the directory where the files will be stored.[/i]
|
H
|
horsey_kim author 3/11/2010 |
YEAH!!!! Thanks Support for helping me with a solution to my problem. Support does it again! |