How to Run Magento Code Externally?

Sometimes need to use Magento functions and classes from outside of the Magento platform. Please check the following code.

<?php

require_once(‘app/Mage.php’); //Path to Magento
umask(0);
Mage::app();

// Insert your code

If you want run this script just save at your own name like upload.php

run your script www.example.com/upload.php

Hope it will help you.