Hello
Im using the script bellow to try to upload MMS messages to my webserver. the folder "data" is CHmoded 777 and im using a swedish SMS/MMS service to send the content of the MMS to my server
now for my problem, when i send a MMS to the payment number of my MMS service, it's recived by the service and forwarded to my server, my server send my response back to my cell "thank yo ufor your mms" BUT no picture is uploaded onto my server in the Folder "data" and i cant figure out why not, do anyone se anyting in my code that would indicate why my picture is not uploaded to the server? my cell sends jpg files as specefied in the code.
in my logs for my server i se the request by my mms service but i dont se any picture upload or decline request. also the MMS is added into my database and get a specific id number.
Im using the script bellow to try to upload MMS messages to my webserver. the folder "data" is CHmoded 777 and im using a swedish SMS/MMS service to send the content of the MMS to my server
now for my problem, when i send a MMS to the payment number of my MMS service, it's recived by the service and forwarded to my server, my server send my response back to my cell "thank yo ufor your mms" BUT no picture is uploaded onto my server in the Folder "data" and i cant figure out why not, do anyone se anyting in my code that would indicate why my picture is not uploaded to the server? my cell sends jpg files as specefied in the code.
in my logs for my server i se the request by my mms service but i dont se any picture upload or decline request. also the MMS is added into my database and get a specific id number.
Code:
<?
// Define database connection
$MYSQL_HOST = 'my host';
$MYSQL_USER = 'database username';
$MYSQL_PASSWORD = 'database pass';
$MYSQL_DATABASE = 'database name';
// turn of PHP error reporting
error_reporting(0);
// connect to the database
mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
mysql_select_db($MYSQL_DATABASE);
// pick out the senders number.
$nr = $_REQUEST['nr'];
// pick up the mms message
$sms = urldecode($_REQUEST['sms']);
// "url to the picture if any was sent with"
$mms = urldecode($_REQUEST['mms']);
// pick out the price of the mms
// (statistic)
$tariff = $_REQUEST['tariff'];
// add to the database
mysql_query('INSERT INTO mms (sender,message,tariff,tstamp) VALUES ("'
. addslashes($nr) . '","'
. addslashes($sms) . '","'
. addslashes($tariff) . '",now())');
// download and save picture
if ($mms != 'data/') {
// pick the ID of the latest database entry
$id = mysql_insert_id();
// read and save the file in the folder 'data'
$file = fopen('data/' . $id . '.jpeg', 'w');
fwrite($file,file_get_contents($mms));
fclose($file);
}
// Answer returned to sender after succsesfull recivement
echo 'thanks for your mms :)';
?>