Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


file has a false mimetype of 'application/octet-stream'

  • Please log in to reply
No replies to this topic

#1 dungpt29


  • Members
  • 45 posts
  • Gender:Male
  • Local time:06:41 PM

Posted 17 February 2013 - 10:21 PM

My operating system is 64-bit Windows 7 Home Premium


I am trying to build a website based on:
1) PHP 5.4.7 (This version enables fileinfo by default)
2) Zend Framework 1.12.0


I am building a form that uploads product images which are inserted into database as the following:


<form method="post"  action="" id="frmAddNewShoes" name="frmAddNewShoes" onsubmit="return frmAddNewShoes_onsubmit(this);" enctype="multipart/form-data">
    <table cellpadding="0" cellspacing="5" width="100%" align="center">
              <td width="120" align="right" nowrap="nowrap" valign="top"><strong>Shoes Image:</strong></td>
              <td><input type="file" id="imgfile" name="imgfile"></td>
             <td align="left"><input type="image" src="<?php echo $this->baseUrl().'/images/img-addnew.jpg'?>" style="width:100px; height:50px;"</td>

<script language="javascript" type="text/javascript">
    function frmAddNewShoes_onsubmit(frm)
        return true;   


When submitting the form, function indexAction() at server is called as the following:


    public function indexAction()
    	if ($this->_request->isPost())
			$adapter = new Zend_File_Transfer_Adapter_Http();			
			$adapter->addValidator('Count', false, array('min' =>1, 'max' => 1))
       			    ->addValidator('IsImage', false, array('jpeg, png, gif'))
					->addValidator('MimeType', false, array('image/jpeg',  'image/png', 'image/gif'))
                    ->addValidator('Size', false, array('max' => '512kB'));
			$adapter->setDestination(APPLICATION_PATH . '/../images/shoes/');

			if (!$adapter->isValid())
    			throw new Exception('Bad image data: '.implode(',', $adapter->getMessages()));	
				$this->view->filename = "Successful upload";
			catch (Zend_File_Transfer_Exception $e) 
        		throw new Exception('Bad image data: '.$e->getMessage());
		$layout = $this->_helper->layout();


I press the Browse button in the form and select an image, for example activation.jpg. Submitting the form, I get the following error message:


Message: Bad image data: File 'activation.jpg' is no image, 'application/octet-stream' detected,File 'activation.jpg' has a false mimetype of 'application/octet-stream'


Please help me solve this error!







BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users