Determine Filesize of Email Attachment Before Downloading

萝らか妹 提交于 2019-12-12 03:43:36

问题


I'm using Zend Mail library to access email and download email attachments. Is there a way to determine the attachment's filesize before downloading?


回答1:


You don't say how you are 'downloading' it. There are many ways to receive an email. The simplest three are:

  1. SMTP - No, there is no way,
  2. POP3 - I think servers typically provide size of the total email, not sure, and
  3. IMAP - I really don't recall

The answer is in the protocol you are using to retrieve (download). If you don't know that, at least you should know the PHP function you're using, so you should mention that.




回答2:


Have you taken a look at PHP's filesize(); function?

http://php.net/manual/en/function.filesize.php

It prints the file size in bytes but obviously you can convert it to whatever you want!



来源:https://stackoverflow.com/questions/3221322/determine-filesize-of-email-attachment-before-downloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!