$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = $txt.time();
$name = $name.".".$ext;
echo $ext;
//check if the files are only image / document
if($ext == "jpg" or $ext == "png" or $ext == "gif" or $ext == "doc" or $ext == "docx" or $ext == "pdf")
{
//here is the actual code to get the file from the url and save it to the uploads folder
//get the file from the url using file_get_contents and put it into the folder using file_put_contents
$upload = file_put_contents("qr/$name",file_get_contents($url));
//check success
if($upload) echo "Success: <a href='qr/".$name."' target='_blank'>Check Uploaded</a>"; else "please check your folder permission";
}
else
{
echo "Please upload only image/document files";
}
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
Question: When bring up the image at http://www.countryshowdown.com/qr/QR_CODE_http_www_countryshowdown_com_contestant_php_id754.png, it shows up just fine, but the image itself isn't anywhere on my server. In other words, when I go looking in the qr directory, it isn't there. Should it be? Am I missing something?