*/
// Constants
//
// Functions.
//
/////////////////////////////////////////////////////////////////////
function move_and_fix_eol($from_path, $to_path) {
/* Move a file, converting Windoze and mac eol sequences to Unix eol.
*
* Input:
* $from_path Pathname to move
* $to_path Place to move to.
*
* Returns: system return code of exec() which copies.
* (0 on success, something else on failure)
*
* Side Effects: moves file
*
* Bugs:
*/
exec("sed -e '" . 's/\r$//' . "' $from_path"
. ' | tr "\\r" "\\n"'
. " > $to_path"
, $dummy
, $result);
unlink($from_path);
return $result;
}
/////////////////////////////////////////////////////////////////////
function explain_error($f, $e) {
/*
* Explain an error code returned by $_FILE[]['error']
*
* Input:
* $f The description of the file to show to the user.
* $e The error code
*
* Returns: String containing html which explains the error.
*
* Side Effects: none
*/
$e = " $f: ";
switch ($e) {
case UPLOAD_ERR_OK:
$e .= "There is no error, the file uploaded with success.";
break;
case UPLOAD_ERR_INI_SIZE:
$e .= "The uploaded file exceeds the upload_max_filesize directive in php.ini.";
break;
case UPLOAD_ERR_FORM_SIZE:
$e .= "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$e .= "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$e .= "No file was uploaded.";
break;
}
$e .= "
";
return $e;
}