Iphone网页应用下载附件功能在php


Iphone web app download attachment function in php

我有一个iphone应用程序,使用uiwebview包括一个移动网站,移动网站是用PHP开发的,有些页面允许人们通过使用头强制下载下载一些附件,因为该文件将被转换为一些二进制文件,最后输出为使用PHP头函数的下载文件,我想知道它会在iphone应用程序uiwebview工作吗?

这个网站提供了一个脚本,他们说可以工作。

这是我的代码发送vcard作为附件没有消息:

    //create a boundary string. It must be unique
    $random_hash = md5(date('r', time())); $alt_random_hash = md5(date('r', time()+1)); 
    //read the atachment file contents into a string, 
    //encode it with MIME base64, 
    //and split it into smaller chunks 
    $attachment = (chunk_split(base64_encode(file_get_contents($url))); 
    $filename = "Alain_Leblanc.vcf";    
    // Write the email message (which will become an attachement)
    $headers .= "
    MIME-Version: 1.0 
    From: info@AlainLeblancAssurances.ca 
    Reply-To: info@AlainLeblancAssurances.ca 
    Content-Type: text/x-vcard; charset=utf-8; name=$filename; boundary=$random_hash  
    Content-Disposition: attachment; filename=$filename 
    Content-Transfer-Encoding: base64
    --$random_hash 
    $attachment
    --$random_hash-- 
    ";
    //send the email  
    $mail_sent = @mail($_POST['userEmail'], "Fiche contacts d'Alain Leblanc", "", $headers); 
    // display email result in browser
    echo $mail_sent ? "rand: ".$random_hash ."<br/>Alt: ".$alt_random_hash."<br/>".$headers : "Mail failed";