hi, sorry for my english
in my form, if i insert in Form tag attachment: enctype='multipart/form-data' the files uploaded but the filename don't result in DB, but if i dont' insert enctype='multipart/form-data' the namefile result but any file is uploaded.
Can you help me, please.
Tank you
in my form, if i insert in Form tag attachment: enctype='multipart/form-data' the files uploaded but the filename don't result in DB, but if i dont' insert enctype='multipart/form-data' the namefile result but any file is uploaded.
Can you help me, please.
Tank you
Hi leon,
in the Auto generated tab you will need to replace $_POST['file_name' ] with $_FILES['file_name']['name']
cheers
Max
in the Auto generated tab you will need to replace $_POST['file_name' ] with $_FILES['file_name']['name']
cheers
Max
Hi Max,
thank's for reply.
I post my Auto generated code because It does not work.
Please, can you tell me where is my mistake?
cheers
leonte54
thank's for reply.
I post my Auto generated code because It does not work.
Please, can you tell me where is my mistake?
cheers
leonte54
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$database->setQuery( "INSERT INTO #__chronoforms_1 VALUES (
'' , '".$inum."','". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('avviso','', 'post', 'string', '' )."' ,
'".JRequest::getVar('go','', 'post', 'string', '' )."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
$_POST['avviso' ] with $_FILES['avviso']['name'];
?>
Hi leonte54,
Max has given you the code we use for Joomla 1.0.x and you have Joomla 1.5.x.
Try replacing:
I think that there may also be some problems in that this will give you the name of the uploaded file, not the name it was saved under (ChronoForms adds a suffix to avoid problems with duplicate file names).
Bob
Max has given you the code we use for Joomla 1.0.x and you have Joomla 1.5.x.
Try replacing:
'".JRequest::getVar('avviso','', 'post', 'string', '' )."' ,
with'".JRequest::getVar('avviso','', 'files['name']', 'string', '' )."' ,
I'm not at all sure if that will work, if it doesn't I can do some research and find the way to access the $_FILES array in Joomla 1.5.xI think that there may also be some problems in that this will give you the name of the uploaded file, not the name it was saved under (ChronoForms adds a suffix to avoid problems with duplicate file names).
Bob
Hi,
this is the JRequest variables list :
http://forum.joomla.org/viewtopic.php?f=476&t=255864
if the code provided by Bob didn't work, you can try to replace his 2nd line of code with this :
Cheers
Max
this is the JRequest variables list :
http://forum.joomla.org/viewtopic.php?f=476&t=255864
if the code provided by Bob didn't work, you can try to replace his 2nd line of code with this :
$_FILES['avviso']['name']
Cheers
Max
Hi,
I tried codes suggested by you but for the first and second code the error is the same:
the file upload but its name does not appear in the database.
For solutions n.3/4/5 the error is:
Parse error: syntax error, unexpected T_STRING in /membri/itcorion/components/com_chronocontact/chronocontact.php(571) : eval()'d code on line 8
Other codes that do not involve uploading files, is operating normally
Thanks
2) -
3) -
4) -
5) -
I tried codes suggested by you but for the first and second code the error is the same:
the file upload but its name does not appear in the database.
For solutions n.3/4/5 the error is:
Parse error: syntax error, unexpected T_STRING in /membri/itcorion/components/com_chronocontact/chronocontact.php(571) : eval()'d code on line 8
Other codes that do not involve uploading files, is operating normally
Thanks
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$database->setQuery( "INSERT INTO #__chronoforms_2 VALUES (
'' , '".$inum."','". date('Y-m-d')." - ".date("H:i:s")."',
'".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('cod_asta', '', 'post', 'string', '' )."' ,
'".JRequest::getVar('avviso', '', 'post', 'string', '' )."' ,
'".JRequest::getVar('invio','', 'post', 'string', '' )."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
header("location: index.php?option=com_content&view=article&id=44");
?>
2) -
'".JRequest::getVar('avviso', '', $_POST['avviso' ], 'string', '' )."' ,
3) -
'".JRequest::getVar('avviso', '', $_FILES['avviso']['name'] 'string', '' )."' ,
4) -
'".JRequest::getVar('avviso', 'files['name']', 'post', 'string', '' )."' ,
5) -
'".JRequest::getVar('avviso', '', 'files['name']', 'string', '' )."' ,
Hi leaonte,
for file names to appear in the database, there is one line hack to chronoconatct.php, this change is added to the new BETA release, and you need NO changes in the Autogenerated code, here its :
change this code :
to be :
for file names to appear in the database, there is one line hack to chronoconatct.php, this change is added to the new BETA release, and you need NO changes in the Autogenerated code, here its :
change this code :
if ( $fileok ) {
$uploadedfile = handle_uploaded_files($original_name, $filename);
to be :
if ( $fileok ) {
$uploadedfile = handle_uploaded_files($original_name, $filename);
$_POST[$allowed_s2[0]] = $filename;
Hi leonte54,
I'm not sure where they've come from but those
Bob
I'm not sure where they've come from but those
&
tags certainly don't belong in this code.Bob
hi,
thank you very much for your answer, the problem now is resolved, it works very well.
thank you very much for your answer, the problem now is resolved, it works very well.
This topic is locked and no more replies can be posted.