Hi guys
I've got a bit of script that changes the file name when uploaded. The script executes when using firefox and chrome but fails to execute on IE, Safari and Opera, and i have no idea why. Hoping someone can shed some light on this for me. All advice greatly appreciated. Here is the code
// Check for an uploaded file:
if (isset($_FILES['upload'])) {
// Validate the type. Should be msword.
$allowed = array('application/msword', 'application/rtf', 'image/jpg');
if (in_array($_FILES['upload']['type'], $allowed)) {
function isAllowed($fileName) {
global $allowed;
return in_array(end(explode(".", $fileName)), $allowed);
}
$target = "../uploads";
$target = $target . basename( $_FILES['upload']['name']) ;
$ok=1;
$explode = explode('.', $_FILES['uploaded']['name']);
$extension = array_pop($explode);
$newname = rand(0, pow(10, 5)).date("M d, Y").$_POST['email'].$extension;
$basename = date("d.m.Y").$_POST['email'].$extension.( $_FILES['upload']['name']);
$base_file = ( $_FILES['upload']['name']);
// Move the file over.
if (move_uploaded_file ($_FILES['upload']['tmp_name'], "../uploads/$newname.{$_FILES['upload']['name']}")) {
//echo '<p><em>The file has been uploaded!</em></p>';
} // End of move... IF.
Thanks