Jump to content

Search the Community

Showing results for tags 'mime'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 5 results

  1. Hey guys, Go easy on me, I'm not a large PHP coder at all however here is the issue I am having. I have acquired a wordpress plugin from a guy to deal with ticketing. From this plugin I am sending out a Mime multipart message with both HTML and plain text code. Here's the thing: If I send this out via gmail's SMTP server the message appears perfectly, however if I send it out via pro.turbo-smtp.com it arrives as an attachment due to the fact that in transit it seems to have lost it's Mime-Version: and Content-type: headers such as displayed below: Date: Fri, 19 Dec 2014 16:02:28 +0000 Return-Path: <REMOVEDADDRESS> To: REMOVEDADDRESS From: Name Here <REMOVEDADDRESS> Reply-To: Subject: Booking Confirmation Message-ID: <edc5de8156becec1bf53e402b25c9b93@REMOVED.co.uk> X-Priority: 3 X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/) MIME-Version: Content-Type: Content-Transfer-Encoding: 8bit --Part_A_aaa4586399e49459e0dce4368165275f Hey Mr A Sample, Thank you for booking with us. I am more than positive that this is not a PHP issue due to it appearing fine via google's SMTP server, but I am just wondering if anyone has ever came across such a thing and if anyone can shed any light? If anyone wants the PHP code I'm sure I can supply. Many thanks in advance!, Chris
  2. I'm working on a two-file upload form and want to be able to check the mime types of two filenames in a string variable. The code below was working when the variable @resume_path contained just one filename. How can I modify this to accommodate two files? when I echo $resume_path, I get, for example: cover_letter_centerline.doc, cover_letter_ctg.doc Thanks! //DO NOT TRUST $_FILES['upfile']['mime'] VALUE !! //Check MIME Type by yourself. $finfo = new finfo(FILEINFO_MIME_TYPE); if (false === $ext = array_search( $finfo->file($_FILES['resume_path']['tmp_name']), array( 'txt' => 'text/plain', 'doc' => 'application/msword', 'pdf' => 'application/pdf', ), true )) { throw new RuntimeException('Invalid file format.'); } echo "Sorry, invalid file format. Please try again."; echo $ext;
  3. I am in the process of creating a script where only certains video types can be uploaded but at the moment am stuck. Here is my code - <?php $title = isset($_POST['title']) ? $_POST['title'] : null; $desc = nl2br(isset($_POST['description'])) ? $_POST['description'] : null; $name = isset($_POST['fullname']) ? $_POST['fullname'] : null; $email = isset($_POST['email']) ? $_POST['email'] : null; $country = isset($_POST['country']) ? $_POST['country'] : null; $video = isset($_FILES['video']); $videoname = isset($_FILES['video']['name']); $videotmp = isset($_FILES['video']['tmp_name']); $videosize = isset($_FILES['video']['size']); $videotype = isset($_FILES['video']['type']); $videoacceptable = array( "video/mp4", "video/ogg", "video/quicktime", ); $videopath = "/videos/"; $videofile = $videopath . $video; if(isset($_POST['submit'])) { //ERROR MESSAGES / VALIDATION if(empty($title)) { $errors[] = "A title is required"; echo "<style type=\"text/css\"> #title { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } elseif(strlen($title) > 80) { $errors[] = "Your title can only be 80 characters long"; echo "<style type=\"text/css\"> #title { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } if(empty($desc)) { $errors[] = "A description is required"; echo "<style type=\"text/css\"> #description { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } if(empty($name)) { $errors[] = "Please enter your full name"; echo "<style type=\"text/css\"> #fullname { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } elseif(strlen($name) > 32) { $errors[] = "Your name can only be 32 characters long"; echo "<style type=\"text/css\"> #fullname { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } if(empty($email)) { $errors[] = "Please enter your email address"; echo "<style type=\"text/css\"> #email { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } elseif(strlen($email) > 50) { $errors[] = "Your email addess can only be 50 characters long"; echo "<style type=\"text/css\"> #email { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors[] = "Please enter a valid email address"; echo "<style type=\"text/css\"> #email { background-color:#F5A9A9;border:1px solid #DF0101; } </style>"; } if($videosize = 0) { $errors[] = "You forgot to upload a video"; } elseif($videosize >= 20000000) { $errors[] = "Your video size is too large, 20mb max"; } elseif(!in_array($videotype, $videoacceptable)) { $errors[] = "The file type is not allowed, only allowed .mp4, .ogg and .mov"; } if(count($errors) === 0) { $connect = mysqli_connect("localhost","username","password"); if(!$connect) { header("Location:"); // ADD ERROR LINK } $dbselect = mysqli_select_db("database"); if(!$dbselect) { header("Location:"); // ADD ERROR LINK } $query = mysqli_query("INSERT INTO cover_videos(title, desc, name, email, country, videotmp, videotype, videosize, videopath) VALUES('$title','$desc','$name','$email','$country','$videotmp','$videotype','$videosize','$videopath')"); move_uploaded_file($videotmp, $videofile); //SEND AN EMAIL TO THE USER $to = $email; $subject = "Thank's for your upload"; $message = ' <html> <head><title>We have received your video</title></head> <body> <h3>Good News!</h3> <p>We have recieved your video and is awaiting approval.</p> </body> </html> '; $headers = 'FROM: no-replyk' . "\r\n"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header("Location:"); //SUCCESSFUL UPLOAD PAGE } } ?> So whats happening is when i go to upload a file, im uploading a .mov file but the error message that pops up is "The file type is not allowed, only allowed .mp4, .ogg and .mov" but the .mov mime is in the videoacceptable array so im a bit stuck at the moment, any know whats the problem?
  4. Hello, I'm having a huge issue right now decoding a zip file from an attachment with a content-encoding of quoted-printable. I have tried a couple different methods (such as decoding the entire attachment or decoding it line by line), but none have produced a valid file when saved. What I don't understand is that I can download and open the file in Outlook fine, so there must be something wrong with the decoder. Here is a code snippet of my recent attempt: elseif ($transferEncoding == 'quoted-printable'){ $fileError = true; $attachmentParts = explode("\n", $currentPart->getContent()); $attachmentArray = array(); foreach ($attachmentParts as $line){ array_push($attachmentArray, quoted_printable_decode($line)); } $attachment = implode("", $attachmentArray); file_put_contents($unzipPath . '.zip', $attachment); } $unzipper = new Decompress(array( 'adapter' => 'Zip', 'options' => array( 'target' => $unzipPath, ) )); $unzipper->filter($unzipPath . '.zip'); unlink($unzipPath . '.zip'); I'm using Zend Framework 2 methods for unzipping the file when it's done, but there is a CRC error because the file is getting corrupted during the decode. This is how the file compares to the original (using Beyond Compare 3): So it is finding the hex for CLRF and removing it from the file. Any ideas on this would be greatly appreciated as I have been trying to solve this for about a month now. Thanks, -mcfloyd
  5. Hi Guys, I am trying to create a script which send a customer an invoice when they place an order. I have written the following code and this works when sent to an email address which is opened using gmail or the iPhone email client, but Microsoft Outlook screams a great big no at me, and just shows me the html in plain text. Any thoughts anyone? I have included the code below: <?php include("includes/conn.php"); $id=1; $random_hash = md5(date('r', time())); $subject="Red Van Tool Sales - Invoice: "; $headers = "From: sales@redvantoolsales.co.uk" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; /*$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $user=isset($_COOKIE['user']) ? $_COOKIE['user'] : null; $sql="select * from user where user_email='$user'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $uid=$array['user_id']; } */ $sql="select * from orders inner join payment_options on orders.payment_options_id=payment_options.payment_options_id inner join postage_options on orders.delivery_id=postage_options.postage_options_id inner join user_address on orders.delivery_address_id=user_address.user_address_id inner join user on orders.user_id=user.user_id where orders.orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); $count=mysqli_num_rows($sql_res); if($count==0) { //header("Location:noauth.php"); echo "fail"; } else { while($array=mysqli_fetch_array($sql_res)) { $order_id=$array['orders_id']; $subject .= $order_id; $order_date=date("d/m/Y", $array['orders_date']); $orders_total=number_format($array['orders_total'],2); $order_subtotal=number_format($orders_total/1.2,2); $vat=number_format($orders_total-$order_subtotal,2); $shipping_total=number_format($array['shipping_total'],2); $payment_fee=number_format($array['payment_fee'],2); $payment_options_name=$array['payment_options_name']; $postage_options_name=$array['postage_option_name']; $user_forename=$array['user_forename']; $user_surname=$array['user_surname']; $address_address=$array['address_address']; $address_city=$array['address_city']; $address_postcode=$array['address_postcode']; $shipping_time=$array['postage_option_shipping_time']; $shipping_time = $shipping_time*86400; $expected_arrival=$array['orders_date']+$shipping_time; $expected_arrival=date("d/m/Y", $expected_arrival); $emailto = $array['user_email']; } } ob_start(); //Turn on output buffering ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="print"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="screen"> </head> <body> <div id="cont"> <div id="container"> <div id="topbar"> <img class="logo" src="http://www.redvantoolsales.co.uk/images/logo.png"> <div id="companyaddress">Red Van Tools<br>Address<br>City<br>Postcode<br>VAT: 000000000<br>sales@redvantoolsales.co.uk<br>01633 000000<br>www.redvantoolsales.co.uk</div> </div> <div id="nextbar"> <div id="customeraddress"><?php echo $user_forename . " " . $user_surname; ?><br><?php echo $address_address; ?><br><?php echo $address_city; ?><br><?php echo $address_postcode; ?></div> <div id="invoicedetail">INVOICE <?php echo $order_id; ?><br><?php echo $order_date; ?></div> </div> <div id="orderdetailbar"> <table> <tr><th width="333">Payment Method</th><th width="333">Order Date</th><th width="333">Estimated Delivery Date</th></tr> <tr><td><?php echo $payment_options_name; ?></td><td><?php echo $order_date; ?></td><td><?php echo $expected_arrival; ?></td></tr> </table> </div> <div id="orderitembar"> <table> <tr><th width="120">Quantity</th><th width="500">Details</th><th width="120">Unit Price (£)</th><th width="120">VAT</th><th width="120">Net Subtotal (£)</th></tr> <?php $sql="select * from order_item inner join products on order_item.product_id=products.product_id inner join price on products.product_id=price.product_id where orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $total = number_format($array['product_price']*$array['product_qty'],2); echo "<tr><td>" . $array['product_qty'] . "</td><td>" . $array['product_name'] . "</td><td>" . number_format($array['product_price'],2) . "</td><td>20%</td><td align=\"right\">" . $total . "</td></tr>"; } ?> </table> </div> <div id="totals"> <table> <tr><td>Net Total</td><td><?php echo $order_subtotal; ?></td></tr> <tr><td>VAT</td><td><?php echo $vat; ?></td></tr> <tr><td><b>GBP Total</b></td><td><b>£<?php echo $orders_total; ?></b></td></tr> </table> </div> </div> </div> </body> </html> <?php $message1 = ob_get_clean(); mail( $emailto, $subject, $message1, $headers ); ?> Thanks guys!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.