note 99568 added to function.passthru
| From: | lb at bostontech dot net | Date: | Wed, 25 Aug 2010 06:13:11 +0000 |
| Subject: | note 99568 added to function.passthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172021@lists.php.net to get a copy of this message | ||
Thanks to "ignacio paz posse" below, I was able to solve a problem where I didn't
want anything echoed back from the shell.
on my system: exec, passthru, and exec all sent standard output back to the browser -- which is a
problem in AJAX apps.
For systems running PHP 5.2 and older, you can use the following code to get the MIME type, e.g. in
this case .mp2/.mp3 files:
ob_start();
passthru("file -bi -- ".escapeshellarg($sourceFile), $finfo);
ob_get_contents();
ob_end_clean();
if ($finfo=='audio/mpeg')
{
}
----
Server IP: 117.104.162.229
Probable Submitter: 203.59.102.142 (proxied: 203.59.102.142)
----
Manual Page -- http://www.php.net/manual/en/function.passthru.php
Edit -- https://master.php.net/note/edit/99568
Del: integrated -- https://master.php.net/note/delete/99568/integrated
Del: useless -- https://master.php.net/note/delete/99568/useless
Del: bad code -- https://master.php.net/note/delete/99568/bad+code
Del: spam -- https://master.php.net/note/delete/99568/spam
Del: non-english -- https://master.php.net/note/delete/99568/non-english
Del: in docs -- https://master.php.net/note/delete/99568/in+docs
Del: other reasons-- https://master.php.net/note/delete/99568
Reject -- https://master.php.net/note/reject/99568
Search -- https://master.php.net/manage/user-notes.php