obtaining the name of an uploaded file...

morio 25 Mar, 2008
I use this code:
<input tabindex="11" name="first_file" size="40" type="file">

Referencing {first_file} in the email template shows nothing.
I expected the NAME of the uploaded file to be transmitted.

The file itself is attached.
Any way to get the filename to show?

Tnx,
morio
GreyHead 25 Mar, 2008
Hi morio,

Try putting
<?php echo $_FILES['first_file']' ?>
in place of {first_file} and see if that does the trick.

Bob
morio 25 Mar, 2008
Hi Bob,
that was quick!

Nice try, but No, I get "Array" instead of the filename.

regards,
morio<br><br>Post edited by: GreyHead, at: 2008/03/25 09:52
GreyHead 25 Mar, 2008
Hi morio,

Too quick - try
 <?php echo $_FILES['first_file']['name'] ?>
and see if that does the trick.

Bob
morio 25 Mar, 2008
Thank you, Bob!
Working perfect now.

The only thing left that does not work is the CC in Special Fields.
Adding the email-field of the sender in the Email field name is working fine as an additional To: Address, but not in CC.

At least I get a copy to the sender,,,

Thanks again,
morio
morio 25 Mar, 2008
Hi!

One more question I ment to ask:
What is the correct entry in the DataView fields to get the name of the uploaded file to show up in "Show saved Data"?

Again, the fieldname causes a blank entry in the Datagrid.

Tnx,
morio
GreyHead 26 Mar, 2008
Hi morio,

To get the cc to work in Special Fields you may need to add an email address in the General Tab CC Email box (any dummy email address will do - try [email]user@example.com[/email]).

Bob
GreyHead 26 Mar, 2008
Hi Morio,

Getting an uploaded file name to show up in Data view . . .

Sorry, that's one for Max.

Bob<br><br>Post edited by: GreyHead, at: 2008/03/25 20:51
Max_admin 26 Mar, 2008
Hi Morio,

To get the file name shown in the data view then it must be stored in the database, you will need to edit the piece of code in the Autogenerated tab, find the $_POST['file_name_field'] and change it to $_FILES['file_name_field']['name'], new entries should have file name stored, old entries no!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
morio 26 Mar, 2008
Hi Max!
First of all thank you for the fast response.

Using this code
<?php 
	global $database;
	
$database->setQuery( "INSERT INTO #__chronoforms_1 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:«»s"«»)."', '".$_SERVER['REMOTE_ADDR']."' , '".mosGetParam($_POST,'realname','')."' , '".mosGetParam($_POST,'email','')."' , '".mosGetParam($_POST,'Groesse','')."' , '".mosGetParam($_POST,'Ausgabe','')."' , '".mosGetParam($_POST,'Auftraggeber','')."' , '".mosGetParam($_FILES['first_file']['name'],'')."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
causes an entry in the database with only the FIRST character of the filename showing😟

Nice try, but you're getting close...

greets,
morio<br><br>Post edited by: GreyHead, at: 2008/03/26 01:54
Max_admin 27 Mar, 2008
Hi Morio,

get it from the mosGetParam function!!😉
Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
boogieman 20 Oct, 2008
Hi All,

I'm new to ChronoForms and just purchased my license today. I have been reading these threads looking for a way to rename my "DataView Fields" to the correct name... example Company instead of Text_1. I read your previous post and i am just not getting it. Is the autoGenerated Code somewhere else?? I have printed my page and it does not list the field names or make any reference to $_POST, i have also checked my MySQL DB and see no category name there either. Please advise.. below is my AutoGenerateed Code...
<?php
		if($paramsvalues->dbconnection == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_MediaKit", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16);
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			global $row_nace_chronoforms_MediaKit;
			$row_nace_chronoforms_MediaKit = $row;
		}
		?>

That's all. Thanks in advance.
GreyHead 20 Oct, 2008
Hi boogieman,

At the moment the DataView uses the column names from the database table as the column headers to display. These in turn are taken from the field names in the form when Create Table was done.

You could change the column names using PHPMyAdmin but they still wouldn't be too pretty. Otherwise it's a code hack or wait for Field Names to come back as a ChronoForms feature (I don't think Max has any plans at present).

Bob
Max_admin 20 Oct, 2008
Hi boogieman,

you may try to get ChronoConnectivity and use it to setup a template for the dataview page, you will get the result you need exactly, let me know if you are interested in this solution and I will put here the latest ChronoConnectivity version so you can get it!

Cheers,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.