Note that there are some explanatory texts on larger screens.

plurals
  1. POparse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
    text
    copied!<p>I need a fresh set of eyes on this. I got this code from someone who said it worked.</p> <p>Here is the error:</p> <pre><code>PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Inetpub\wwwroot\2am\employment\send-email-form.php on line 19 </code></pre> <p>Line 19 is the first line of <code>GetUploadedFileInfo()</code>. I get the error for line 20 and 21 also. Its obviously with the <code>$file_info</code> array but whats wrong here?</p> <pre><code>&lt;?php $max_allowed_file_size = "100"; // this is size in KB list($name_of_uploaded_file, $type_of_uploaded_file, $size_of_uploaded_file) = GetUploadedFileInfo(); if(!Validate($name_of_uploaded_file, $type_of_uploaded_file, $size_of_uploaded_file, $max_allowed_file_size)) { exit(); } LoadUploadedFile($name_of_uploaded_file); $path_of_uploaded_file = "uploads/" . $name_of_uploaded_file; include_once('Mail.php'); include_once('mime.php'); ComposeMail($path_of_uploaded_file); //////////////////// Functions //////////////////////// function GetUploadedFileInfo() { $file_info[] = basename($_FILES['uploaded_file']['name']); $file_info[] = substr($file_info[0], strrpos($file_info[0], '.') + 1); $file_info[] = $_FILES["uploaded_file"]["size"]/1024; return $file_info; } function Validate($name_of_uploaded_file, $type_of_uploaded_file, $size_of_uploaded_file, $max_allowed_file_size) { if($size_of_uploaded_file&gt;$max_allowed_file_size ) { echo "Size of file is greater than" . $max_allowed_file_size . " KB. &lt;a href='attachment_email_form.html'&gt;Click Here to upload a smaller sized file.&lt;/a&gt;"; return false; } $allowed_extension = array("jpg", "jpeg", "gif", "bmp"); for($i=0; $i&lt;sizeof($allowed_extension); $i++) { $allowed_extension[$i] = strtoupper($allowed_extension[$i]); } $type_of_uploaded_file = strtoupper($type_of_uploaded_file); if(!(in_array(strtoupper($type_of_uploaded_file),$allowed_extension))) { echo "You have uploaded a file with an extension of " . $type_of_uploaded_file . " . This type is not allowed. Please upload a file with allowed image extensions like jpg, jpeg, bmp, gif. &lt;a href='attachment_email_form.html'&gt;Click Here to upload a file with allowed extension.&lt;/a&gt;"; return false; } return true; } function LoadUploadedFile($name_of_uploaded_file) { move_uploaded_file($_FILES["uploaded_file"]["tmp_name"], "uploads/" . $name_of_uploaded_file); return true; } function ComposeMail($name_of_uploaded_file) { $name = $_POST['name']; $user_message = $_POST['message']; $to = "RecipietnEmail@hotmail.com"; $subject="An email with attachement is sent"; $from = "SenderEmail@hotmail.com"; $text = "A user " . $name . "has sent you this message and an attachment: " . $user_message; $message = new Mail_mime(); $message-&gt;setTXTBody($text); $message-&gt;addAttachment($name_of_uploaded_file); $body = $message-&gt;get(); $extraheaders = array("From"=&gt;$from, "Subject"=&gt;$subject); $headers = $message-&gt;headers($extraheaders); $mail = Mail::factory("mail"); $mail-&gt;send($to, $headers, $body); echo "Your Email with attachment was sent."; } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload