bullchina Posted September 19, 2006 Share Posted September 19, 2006 I am creating a small script to output news info from a database into rss format, and I want the ability to include enclosures, but I want it to be as easy as possible for any person to update the database. the enclosure item in an rss feed requires a url, the length in bytes of the file, and the filetype.I am using the filesize() function to get the bytes, so the user doesn't have to input that element into the database, but is there a more automated way of adding the file type attribute, without creating a huge switch statement? I can't seem to find anything about this, but I also don't really know what terms to search for. I suppose the switch statement won't be that big, but I thought there may be a better way to automate this process.Thanks for your help,dave Quote Link to comment Share on other sites More sharing options...
bullchina Posted September 19, 2006 Author Share Posted September 19, 2006 ok, i found something called finfo_open(FILEINFO_MIME); which is supposed to give back the mime type (i forgot that word...).i guess you have to have a pear fileinfo module installed to get that to work.also, i found that the filesize function will not work with absolute http url's. it must be a local file.then i saw that readfile() will return the number of bytes of any file, but that seems a little inefficient. I think it's a better idea for me to store the local path to the file relative to the site root in the database, and then appen the doc_root upon outputting the rss...is that right, or is there a better way? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.