Here is the code...
Code: Select all
if ($_SERVER['REQUEST_METHOD'] != "POST")
{
include "upload.html.php";
}
else
{
switch($_FILES['upload']['error']):
case UPLOAD_ERR_OK:
$ext = strtolower(pathinfo($_FILES['name']['name'], PATHINFO_EXTENSION));
switch ($ext):
case 'csv':
$destfile = '\Files\csv\ ' . basename($_FILES['name']['upload'];
$ret = @move_uploaded_file($_FILES['name']['tmp_name'], $destfile);
if ($ret === false)
echo htmlspecialchars('Unable to move file', ENT_QUOTES, 'utf-8')
else
echo htmlspecialchars('File moved successfully', ENT_QUOTES, 'utf-8')
break;
case 'jpg': case'jpeg':
$destfile = '../www/Test/Upload/Files/images/' . basename($_FILES['name']['upload'];
$ret = @move_uploaded_file($_FILES['name']['tmp_name'], $destfile);
if ($ret === false)
echo htmlspecialchars('Unable to move file', ENT_QUOTES, 'utf-8')
else
echo htmlspecialchars('File moved successfully', ENT_QUOTES, 'utf-8')
break;
default:
echo htmlspecialchars('Invalid File Type', ENT_QUOTES, 'utf-8');
break;
break;
case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE:
$output = "Incorrect File Size, Please Reupload"
include 'output.html.php';
break;
case UPLOAD_ERR_PARTIAL:
$output = 'Partial file found, Please reupload';
include 'output.html.php';
break;
case UPLOAD_ERR_NO_FILE:
$output = 'No file found, Please reupload';
include 'output.html.php';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$output = 'Incorrect Directory';
include 'output.html.php';
break;
default:
break;
notice that there is a space between the backslash after csv and the quotation mark and everything with the variable looks okay...
But without that space, the variable name becomes a part of the string and does not populate the script with the appropriate value... Plus I am getting a parse error on that line. More than likely the two problems are related, but I am not sure....
Why???