title: PHP/JS Froala imag upload not working properly
body: <p>I went to <a href="http://editor.froala.com/server-integrations/php-image-upload" rel="nofollow">Froala Docs</a>
  , copied and edited the script (a bit) but somehow it doesn't seem to work, I didn't even get a response. Here's my code:<br>
  upload.php:</p>
  
  <pre><code>&lt;?php
  // Allowed extentions.
  $allowedExts = array("gif", "jpeg", "jpg", "png");
  
  // Get filename.
  $temp = explode(".", $_FILES["file"]["name"]);
  
  // Get extension.
  $extension = end($temp);
  
  // An image check is being done in the editor but it is best to
  // check that again on the server side.
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/jpg")
  || ($_FILES["file"]["type"] == "image/pjpeg")
  || ($_FILES["file"]["type"] == "image/x-png")
  || ($_FILES["file"]["type"] == "image/png"))
  &amp;&amp; in_array($extension, $allowedExts)) {
  // Generate new random name.
  $name = sha1(microtime()) . "." . $extension;
  
  // Save file in the uploads folder.
  move_uploaded_file($_FILES["file"]["tmp_name"], getcwd() . "images/" . $name);
  
  // Generate response.
  $response = new StdClass;
  $response-&gt;link = "images/" . $name;
  echo stripslashes(json_encode($response));
  }
  ?&gt;
  </code></pre>
  
  <p>upload.js (included in my website):    </p>
  
  <pre><code>$(function(){
  $('#edit').editable({
  // Set the image upload parameter.
  imageUploadParam: 'file',
  
  // Set the image upload URL.
  imageUploadURL: '/upload.php',
  
  // CORS. Only if needed.
  crossDomain: false,
  
  // Additional upload params.
  imageUploadParams: {id: 'edit'},
  
  // Set the image error callback.
  imageErrorCallback: function (error) {
  
  // Custom error message returned from the server.
  if (error.code == 0) { error: 'My custom error message.' }
  
  // Bad link.
  else if (error.code == 1) { error: 'Bad link.' }
  
  // No link in upload response.
  else if (error.code == 2) { error: ' No link in upload response.' }
  
  // Error during file upload.
  else if (error.code == 3) { error: 'Error during file upload.' }
  
  // Parsing response failed.
  else if (error.code == 4) { error: 'Parsing response failed.' }
  
  // Image too large.
  else if (error.code == 5) { error: 'Image too large.' }
  
  // Invalid image type.
  else if (error.code == 6) { error: 'Invalid image type.' }
  
  // Image can be uploaded only to same domain in IE 8 and IE 9.
  else if (error.code == 7) { error: 'Image can be uploaded only to same domain in IE 8 and IE 9.' }
  }
  })
  });    
  </code></pre>
  
  <p>I looked everywhere to find a solution but the problem is still unsolved, please help me, I appreciate it   </p>