Jump to content

shahzad

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shahzad's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i am trying sample code to send form to an email with two attachment i am receiving 1st attachment but i am now able to receive second attachment. http://www.royalcustoms.net/phpemail/ my code is below for mail.php <html> <head> <title> Sending Email </title> </head> <body> <?php // Read POST request params into global vars $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; // Obtain file upload vars $fileatt2 = $_FILES['fileatt2']['tmp_name']; $fileatt2_type = $_FILES['fileatt2']['type']; $fileatt2_name = $_FILES['fileatt2']['name']; $headers = "From: $from"; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } if (is_uploaded_file($fileatt2)) { // Read the file to be attached ('rb' = read binary) $file2 = fopen($fileatt2,'rb'); $data2 = fread($file2,filesize($fileatt2)); fclose($file2); // Base64 encode the file data $data2 = chunk_split(base64_encode($data2)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt2_type};\n" . " name=\"{$fileatt2_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt2_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data2 . "\n\n" . "--{$mime_boundary}--\n"; } // Send the message $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo "<p>Mail sent! Yay PHP!</p>"; } else { echo "<p>Mail could not be sent. Sorry!</p>"; } ?> </body> </html>
  2. excellent idea litebearer... how to grab name of file in folder... can you please help me with function name or what it called so that i can learn to use it.. thanks again
  3. i have around 200 images in a folder i want to upload it to the server and i want to store there name in mysql database. i know the script to upload 1 at a time but i need to select the file every time is it possible to give directory path and script will get all the images and get there name insert to the database?? thanks for your time and help in advance
  4. Thaks pbs it works jl5501 i tried offset but i am getting an error. i think offset is not valid without limit... thankyou guys
  5. ok thanks 1 more thing now as it is news table i dont know how many record it will have at that point of time but everytime i will display news in front end i need to skip 5 record and display all.. so there is a way where i can tell skip first 5 and get all records?? thanks again
  6. i have a table name "News" I want to fetch records from 6 onwards what will be the query for it. for example if table news have 10 records what i want is to fetch record 6 to 10 or we can say skip first 5 records. Thanks in advance Regards, Shahzad
  7. thanks yes to use date is efficient only 2 line code and im done...
  8. thanks both of you... its working fine jl5501 yes provide me the code i want to see how to use strftime and have st, nd, rd, th bit.. Thanks Again
  9. I am storing date as 2010-01-26 in Mysql But i want to display it as November 29th, 2009 to the user how to format the date?? thanks in advance
  10. hahaha yes yes i got an idea thanks your help.
  11. the query for scrolling is following but i am just scrolling date with short news. $querynews="select * from tablenews"; ok i got an idea now how to control news to diplay current month news.. but what about archive now clients wants when he will click News Archive a list of months and years appears which have news appear so that users can click and view all the news for that following month..
  12. You will need to be more specific. Post your current code and explain which available columns exist in your database. For example, is there a "date" column in your database that you can use to sort the news by date? Are you currently even using a database and PHP? my website address is http://www.omegadubai.com/ on left side you can see news scrolling panel. link to news detail page http://www.omegadubai.com/News_Detail.php?Pageid=5 yes i am using MySql as database Tablename : tablenews fields TableID Date NewsScroll NewsTitle NewsDescription Image Link PDF thanks for your time bro
  13. in my website there is news scrolling panel where what ever the new inserted in database scrolls. but what i need now that only fresh or current month news will scroll and old news will archived where i can display it in archive page in monthly or yearly view. is it possible if yes what will be the logic or working behind it. Thanks in advance Thanks & Best regards, Shahzad Ahmed
×
×
  • 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.