Document Contains no data error
| From: | Randy Jonasz | Date: | Fri, 15 Sep 2000 06:07:12 +0000 |
| Subject: | Document Contains no data error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16942@lists.php.net to get a copy of this message | ||
Hello everyone,
I'm wondering if anyone has come across this error. I have a function such
as this inside an object:
function addbanner($fileURL,$url ) {
if( $this->iURLid ) {
if( !ereg("^http://",$fileURL) ||
!ereg("^http://",$url) )
alert_error("Image URLs must start with http://");
if( $fhread = fopen($fileURL,"r") ) {
$filecontents = fread($fhread,-1);
$tempfile = "/usr/tmp/banner";
$fhtemp = fopen($tempfile,"w+");
fwrite($fhtemp,$filecontents);
fclose($fhtemp);
$aImgInfo = getimagesize($tempfile);
$iImgWidth = $aImgInfo[0];
$iImgHeight = $aImgInfo[1];
$iImgFlag = $aImgInfo[2];
$aImgType = Array("gif","jpg","png");
$strImgType = $aImgType[$iImgFlag-1];
if( $iImgWidth != 468 || $iImgHeight != 60 ) {
$error = "Image must be 468 pixels width by 60 pixels high";
unlink($tempfile);
alert_error($error);
}
if( $strImgType != 'gif' ) {
$error = "Image must be in gif format";
unlink($tempfile);
alert_error($error);
}
if( filesize($tempfile) > 12288 ) {
$error = "Image must be under 12kb";
unlink($tempfile);
alert_error($error);
}
//if file exists delete it before saving new file or make new file name from db
if( $this->iBannerId ) {
$filename = $this->iBannerId . "." . $strImgType;
unlink("$this->strImageDir$filename");
}
else {
$db = new db_obj;
$now = time();
$strSQL = "INSERT INTO exbanners (banid,memid,urlid,url,created,record_updated)
values(nextval('bannerid'),$this->iAcctNo,$this->iURLid,'$url',$now,$now)";
if( $db->update($strSQL) ) {
$this->iBannerId = $db->get_recordId("bannerid");
$filename = $this->iBannerId . "." . $strImgType;
$db->reset();
}
else {
$db->reset();
$error = "Could not access database";
$objError = new error_obj($error);
return $objError->display_error(0);
}
}
$strFilePath = "$this->strImageDir/$filename";
copy($tempfile,$strFilePath);
unlink($tempfile);
return msgreport("Your banner has been submitted. After it has been validated,
Click2Net will begin displaying it.");
}
else {
$objError = new error_obj("Could not get image $fileURL");
return $objError->display_error(0);
}
}
else {
$objError = new error_obj("No Account specified");
return $objError->display_error(0);
}
} //end of addbanner function
The problem is that after it executes, Netscape reports the page contains
no data. The db is updated, the image file is downloaded from the net,
copied to the appropriate dir, i.e. everything is executing as expected
except for output to the browser. What could be causing this? Any help
would be, at this point, much appreciated!
Randy Jonasz
Software Engineer
Click2net Inc.
Web: http://www.click2net.com
Phone: (905) 271-3550
"You cannot possibly pay a philosopher what he's worth,
but try your best" -- Aristotle