Autor | Zpráva | ||
---|---|---|---|
servertom Profil |
#1 · Zasláno: 9. 8. 2010, 19:52:23
Ahoj, potřeboval bych poradit s chybou na kterou nemužu přijít.mám kod na nahrávání souborů a vždy se mi ukáže tato chyba "Failed to find flength file" (nezobrazí se mi ProgressBar,zobrazí se chyba ale soubor se nahraje a po nahrání se zobrazí co má.
Zde je kod <?php $UPLOAD_ID = ''; // Initialize upload id include("./include/common.php"); if(isset($_GET['upload_id']) && preg_match("/^[a-zA-Z0-9]{32}$/", $_GET['upload_id'])){ $UPLOAD_ID = $_GET['upload_id']; } else{ kak("<span class='error'>Invalid parameters passed</span>", 1, __LINE__); } $flength_file = $TEMP_DIR . $UPLOAD_ID . '.dir/' . $UPLOAD_ID . '.flength'; $hook_file = $TEMP_DIR . $UPLOAD_ID . '.dir/' . $UPLOAD_ID . '.hook'; $found_flength_file = false; $found_hook_file = false; // Keep trying to read the flength file until timeout for($i = 0; $i < $_INI['flength_timeout_limit']; $i++){ if($total_upload_size = readUbrFile($flength_file, $_INI['debug_ajax'])){ $found_flength_file = true; $start_time = time(); break; } clearstatcache(); sleep(1); } // Failed to find the flength file in the alloted time if(!$found_flength_file){ showAlertMessage("<span class='error'>Failed to find flength file</span>", 1); } elseif(strstr($total_upload_size, "ERROR")){ // Found the flength file but it contains an error list($error, $error_msg) = explode($DATA_DELIMITER, $total_upload_size); stopUpload(); showAlertMessage("<span class='error'>" . $error_msg . "</span>", 1); } else{ startProgressBar($UPLOAD_ID, $total_upload_size, $start_time); } ?> Uměl by někdo poradit.Díky. |
||
Keeehi Profil |
#2 · Zasláno: 9. 8. 2010, 20:09:57
if($total_upload_size = readUbrFile($flength_file, $_INI['debug_ajax'])){ $found_flength_file = true; $start_time = time(); break; } Tato podmínka se nikdy nevykoná. Funkci readUbrFile() neznám a netuším kde jste vzal proměnnou $_INI['debug_ajax'] |
||
servertom Profil |
#3 · Zasláno: 9. 8. 2010, 20:23:34
Funkce Funkce readUbrFile() je definována jinde
function readUbrFile($file, $debug_ajax=0){ if(@is_file($file)){ if(@is_readable($file)){ $file_contents = ''; if(function_exists('file_get_contents')){ if(($file_contents = @file_get_contents($file)) !== false){ return $file_contents; } else{ if($debug_ajax){ showDebugMessage("Failed to read file contents:" . $file); } return false; } } else{ if(($fh = @fopen($file, "rb")) !== false){ if(($file_contents = @fread($fh, @filesize($file))) !== false){ fclose($fh); return $file_contents; } else{ if($debug_ajax){ showDebugMessage("Failed to fread file:" . $file); } return false; } } else{ if($debug_ajax){ showDebugMessage("Failed to open file:" . $file); } return false; } } } else{ if($debug_ajax){ showDebugMessage("Failed to read file:" . $file); } return false; } } else{ if($debug_ajax){ showDebugMessage("Failed to find file:" . $file); } return false; } } Na ten debug_ajax se podívám. |
||
Časová prodleva: 14 let
|
0