Permalink
Browse files

Test for multipart seems reversed. Didn't work, now it does.

  • Loading branch information...
1 parent a66b71d commit e26eecd9808a1f71040cd986b5531527f0b4bb5a @odinho committed Oct 5, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 examples/upload.php
View
@@ -56,7 +56,7 @@
if (!file_exists($targetDir))
@mkdir($targetDir);
-// Remove old temp files
+// Remove old temp files
if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
while (($file = readdir($dir)) !== false) {
$tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
@@ -70,7 +70,7 @@
closedir($dir);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
-
+
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
@@ -80,7 +80,7 @@
$contentType = $_SERVER["CONTENT_TYPE"];
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
-if (strpos($contentType, "multipart") !== false) {
+if (!strstr($contentType, "multipart")) {
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
// Open temp file
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
@@ -121,12 +121,12 @@
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
- // Strip the temp .part suffix off
+ // Strip the temp .part suffix off
rename("{$filePath}.part", $filePath);
}
// Return JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
-?>
+?>

0 comments on commit e26eecd

Please sign in to comment.