For a bit more information, the reason why I need this is that I emailed my hosting company to ask them to change Alternative to allow_url_fopen to ON.
Their reply:
Yes, we can enable this but it is off by default because it is often exploited and can be a security risk to your web site. We can enable this, but we will also require a list of IP address that you wish to connect to as we will need to add these as exceptions to the firewall.
I don't have a static IP so it wouldn't work... What does everyone else do?
Most upload examples require fopen... e.g.
PHP Code:
move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img");
$instr = fopen("latest.img","rb");
$image = addslashes(fread($instr,filesize("latest.img")));
So thats why I'm after whys that dont require fopen etc.
Am currently playing with this example:
PHP Code:
$target = "img/products/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}