Please replace the ??? with your data!
- Your URL: http://www.wwcares.org
- The browser used: IE7, FF3, Chrome
- cforms version: 8.7
- Your Wordpress version: 2.6.1
[desc]:
I have create a small file upload form to allow our remote buildings to upload documents. The form consists of a drop down with 5 names and the file upload field. The file gets successfully uploaded and if I look in the tracking db the dropdown selection is being properly recorded as well. What I need is a way to tell what the value of the dropdown is and preferably pre-pend it on the file name. Alternatively it could get uploaded to a different folder based on that selection.
In looking at the following code I was able to pre-pend a timestamp uniqueID to the files. What would I need to do to get the drop down value as well? I looked at my_functions but I am worried that could be overkill as I don't want to try and recreate the upload process. Would that even work, overriding the upload from my-functions??
Thanks!
[code]
//
// Files uploaded??
//
$filefield=0;
$temp = explode( '$#$',stripslashes(htmlspecialchars(get_option('cforms'.$no.'_upload_dir'))) );
$fileuploaddir = $temp[0];
if ( isset($_FILES['cf_uploadfile'.$no]) ) {
foreach( $_FILES['cf_uploadfile'.$no][tmp_name] as $tmpfile ) {
//copy attachment to local server dir
if ( is_uploaded_file($tmpfile) )
$uniqueID=date("YmdHis");
move_uploaded_file($tmpfile,$fileuploaddir.'/'.$uniqueID."_'.$file['name'][$filefield]);
$filefield++;
}
}
[/code]