Can't figure out how to surpress this error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a page that has a form allowing users to upload a file.  The
following page processes the information they entered checking all form
fields with "isset" before attempting to process any of the information.
The script works fine EXCEPT when the user does NOT upload a file...then
the page displays this error:

"PHP Notice: No file uploaded in Unknown on line 0 PHP Warning: Cannot
send session cache limiter - headers already sent in
E:\tatumpartners\tcms_admission\public_site_email_contact_process.php on
line 2 "

The problem is that everything still processes correctly in all
cases...but the error is still displayed and this looks bad from the
user's perspective.


This is the code that handles the file upload:

if(isset($_FILES['userfile']) && $_FILES['userfile']['name'] !="")
{
$file_url1 = $_FILES['userfile']['tmp_name'];
$file_name1 = $_FILES['userfile']['name'];
$file_type1 = $_FILES['userfile']['type'];

$fp1 = fopen($file_url1,"r");
$str1 = fread($fp1, filesize($file_url1));
$str1 = chunk_split(base64_encode($str1));
$message .= "--MIME_BOUNDARY\n";
$message .= "Content-Type: $file_type1 ; name=\"$file_name1\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str1\n";
$message .= "\n";
}



Is there anyway other than what I have done here to surpress the error
message from displaying?


Thanks,
Ron






[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux