Forums

Weird Problem

nmay 24 Jun, 2008
Here is what I have in the form code
<table border=0 cellpadding=3 cellspacing=0>
<tr>
<td colspan="2" align="left">
<b>
If you have your genetic test results scanned into a digital document and want to upload a copy, 
please browse your file below. A second or third report is optional.</b>
</td>
</tr>
<tr>
<td align="right" style="background-color:yellow;">Genetic Test Report</td>
<td align="left" nowrap style="background-color:teal;">
<input type="file" name="file1" id="file1"></input>
</td>
</tr>
<tr><td></td>
<td>
<input type="submit" name="upload" value="submit">
<input type="reset" value="reset">
</td>
</table>
Here is what I have in the auto-generated
<?php
$user =& JFactory::getUser();
$userid = $user->get('id');
$database =& JFactory::getDBO();
$filePath= JPATH_SITE . DS . 'components' . DS . 'com_chronocontact' . DS . 'upload' . DS;
$today=date("Y-m-d");
$today2=date("Ymd");
if(isset($_POST['upload']) && $_FILES['file1']['size'] > 0)
{
$fileName1 = preg_replace('`[^a-z0-9-_.]`i','',$_FILES['file1']['name']);
$tmpName1 = $_FILES['file1']['tmp_name'];
$fileSize1 = $_FILES['file1']['size'];
$fileType1 = $_FILES['file1']['type'];
$openfile1= $filePath . $userid . '_' . $today2 . '_' . $fileName1;
$fp1 = fopen($openfile1, 'r') or die ("something is jacked up!"); 
$content1 = fread($fp1, filesize($openfile1));
$content1 = addslashes($content1);
fclose($fp1);
$query1 = "INSERT INTO jos_uploads (userid, name, type, size, content, submit_date) VALUES
 ('$userid', '$fileName1', '$fileType1', '$fileSize1', '$content1', '$today')";
$database->setQuery($query1);
if (!$database->query())
 {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>";    }
}
?>
Sometimes I can upload pictures, sometimes I fail, usually when the size is larger than 1mb, I set upload size from 4kb to 2048kb. And sometimes if I upload a 3mb pic, the javascript alert will not come up.

Getting following error, I am so lost.

chronocontact.php on line 229, referer: http://localhost/udp/index.php?option=com_chronocontact&chronoformname=upload
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 72, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 72, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$imagever in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 74, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 80, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 80, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$validate in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 82, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.html.php on line 20, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 15:55:35 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.html.php on line 20, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:34 2008] [error] [client 127.0.0.1] File does not exist: C:/Apache2.2/htdocs/favicon.ico
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 72, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 72, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$imagever in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 74, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 80, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 80, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$validate in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.php on line 82, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Undefined offset: 0 in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.html.php on line 20, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:23:39 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\components\\com_chronocontact\\chronocontact.html.php on line 20, referer: http://localhost/udp/index.php?option=com_user&view=login&Itemid=29
[Tue Jun 24 16:26:51 2008] [error] [client 127.0.0.1] PHP Notice: Only variable references should be returned by reference in C:\\Apache2.2\\htdocs\\udp\\libraries\\joomla\\application\\module\\helper.php on line 288, referer: http://localhost/udp/index.php?option=com_chronocontact&chronoformname=upload
[Tue Jun 24 16:26:51 2008] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in C:\\Apache2.2\\htdocs\\udp\\libraries\\joomla\\application\\module\\helper.php on line 93, referer: http://localhost/udp/index.php?option=com_chronocontact&chronoformname=upload
[Tue Jun 24 16:26:51 2008] [error] [client 127.0.0.1] PHP Notice: Only variable references should be returned by reference in C:\\Apache2.2\\htdocs\\udp\\libraries\\joomla\\application\\module\\helper.php on line 288, referer: http://localhost/udp/index.php?option=com_chronocontact&chronoformname=upload

GreyHead 25 Jun, 2008
Hi nmay,

Hard to make sense of this. The error reports look as though the ChronoForms form parameters aren't being found in the database.

The form code looks OK excpet that </input> isn't a valid tag, close the <input . . . /> tag instead - but this shouldn't cause any problem.

The Autogenerated code might or might not be OK - why not just use the built in ChronoForms code for handling uploaded files?

Bob
This topic is locked and no more replies can be posted.