Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 476735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:31:11+00:00 2026-05-13T00:31:11+00:00

Say, I have an application/xhtml+xml content and a gif image. How can I serve

  • 0

Say, I have an application/xhtml+xml content and a gif image. How can I serve (not render) these two in a single http get request (using PHP)? It should be a multipart/related content. After reading this RFC, I tried something; but it did not work. (No, I am not trying to send emails with attachment)

Thanks in advance.

EDIT: Finally I succeeded doing that. I think, it will be useful if I write how I did that. I have added this as an answer. Please look below.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:31:11+00:00Added an answer on May 13, 2026 at 12:31 am

    Here is it [worked for me] (No, I did not used PHPMailer; may be it is useful, but I could not make it working):

    // Two contents : application/xhtml+xml and image/gif
    // Here we go
    <?php
        $boundary = "ghorar#deem";
        $im_len = filesize("path/to/abc.gif")
        header("Content-Type:multipart/related; boundary=\"$boundary\"; type=\"application/xhtml+xml\"");
        $xml_cnt = <<<EOD
    <media xmlns="http://www.sth.com/sth.xsd">
        <objectURI>cid:112509abc@syz.com</objectURI>
        <size>$im_len</size>
        <type>image/gif</type>
        <name>abcxyz</name>     
        <description>blah blah</description>
    </media>
    EOD;
        $xml_len = strlen($xml_cnt);        
        $im = imagecreatefromgif("path/to/abc.gif");
        $to_send = "This is a multi-part message example in MIME format
    
    --$boundary
    Content-Type: application/xhtml+xml;
    Content-ID: <e4509xml@asd.com>
    Content-Length: $xml_len
    
    $xml_cnt
    --$boundary
    Content-Type: image/gif;
    Content-ID: <112509abc@syz.com>
    Content-Length: $im_Len
    Content-Transfer-Encoding: binary
    
    ";
        echo $to_send;
        imagegif($im);
        echo "\r\n--$boundary--";
        imagedestroy($im);
    ?>
    

    You can load the xml from file also. But, note that if your xml refers the image (like I did here) you need to refer that with its Content-ID. Also, note the ‘<‘ ‘>’ characters in the Content-ID field of the image (after the boundary) and the ‘cid:’ notation in the place where it is referred. It worked for me. Thanks to Carlos Lima for spending time for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have an application where the user can attribute scores to movies,
Lets say i have an application which has three text-fields, and i can type
Let's say I have an application with two files. Console.cs and Business.cs Console.cs has
Say I have an application that used an ORM (I am thinking of nHibernate
Let's say that I have an application frame, and I want to show a
We have a WPF application, let’s say I have a Department object, in it
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
How is the app.config binding in .Net? Let's say if I have an application
Say we have a standard WPF-application, and I want to show some UI-elements on
Say you have the source of an application, and you're debugging the jar via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.