forbidden-type
'
);
}
// Create the user directory
if(!is_dir($content_dir)) {
mkdir($content_dir, 0777, true);
chmod($content_dir, 0777);
}
// Create (or re-create) the security file
if(!file_exists($security_file))
file_put_contents($security_file, securityHTML());
// File upload error?
if(!is_uploaded_file($tmp_filename) || !move_uploaded_file($tmp_filename, $path)) {
exit(
'
move-error
'
);
}
// Resize and compress if this is a JPEG file
if(preg_match('/^(jpg|jpeg|png|gif)$/i', $ext)) {
// Resize the image
resizeImage($path, $ext, 1024, 1024);
// Copy the image
$thumb = $content_dir.'/'.$name.'_thumb.'.$ext;
copy($path, $thumb);
// Create the thumbnail
if(resizeImage($thumb, $ext, 140, 105))
$thumb_xml = ''.htmlspecialchars($location.'store/share/'.$user.'/'.$name.'_thumb.'.$ext).'';
}
// Return the path to the file
exit(
'
'.htmlspecialchars($location.'store/share/'.$user.'/'.$name.'.'.$ext).'
'.htmlspecialchars($new_name).'
'.htmlspecialchars(getFileMIME($path)).'
'.htmlspecialchars(filesize($path)).'
'.$thumb_xml.'
'
);
}
// Bad request error!
exit(
'
bad-request
'
);
?>