I have a problem for getting a filename from File upload in chronoform.I need a file name for storing a name into DB. But i cann't get a filename from file upload field.
I use simple program for displaying values of filename . Before that, a filename could be empty value. I Give a sample code for my form below.
<label class="cf_label" style="width: 150px;">NAme</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_0" name="text1" type="text" />
<label class="cf_label" style="width: 150px;">FILE</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_1" name="file1" type="file" />
<input value="Submit" name="button_2" type="submit" />
Phe PHP code for display file name is....
<?php
echo "<br/> <strong> Result is </strong>";
echo "<br/> Name : ".$_POST['text1'];
echo "<br/> FILE : ".$_POST['file1'];
?>
After submitting a form, i could get the following.
Result is
Name : sdsdsd
FILE :
Here, The filename could be empty. So pls provide a solution for this.
I use simple program for displaying values of filename . Before that, a filename could be empty value. I Give a sample code for my form below.
<label class="cf_label" style="width: 150px;">NAme</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_0" name="text1" type="text" />
<label class="cf_label" style="width: 150px;">FILE</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_1" name="file1" type="file" />
<input value="Submit" name="button_2" type="submit" />
Phe PHP code for display file name is....
<?php
echo "<br/> <strong> Result is </strong>";
echo "<br/> Name : ".$_POST['text1'];
echo "<br/> FILE : ".$_POST['file1'];
?>
After submitting a form, i could get the following.
Result is
Name : sdsdsd
FILE :
Here, The filename could be empty. So pls provide a solution for this.
Hi tamizhiniyan,
In ChronoForms v3 the file name is available from this code
You can add this to the form data for the DB Connection with the extre line
Bob
In ChronoForms v3 the file name is available from this code
<?php
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$file1_name = $MyUploads->attachments['file1'];
?>
You can add this to the form data for the DB Connection with the extre line
JRequest::setVar('file1_name', $file1_name);
Bob
Its not working...
This topic is locked and no more replies can be posted.