Help with php generated file.
Posted: Thu Jun 09, 2005 10:24 am
Hi
I am having some teathing problems with somne auto print label software. Very simple. Our Server generates a label via php and the user saves it to the desktop, the software recognises the file is their and prints it.
Problem I am having is this:-
If you save the file directly to the desktop the software says its a bad file. If you open the file then save it back to the desktop (without even making any changes) the software accepts the file and prints it.
I am guessing its how the php is closing the file. Can any one point me in the right direction.
Here is the code
header('Content-type: text/plain; charset=us-ascii');
header('Content-disposition: inline; filename=data.doc');
echo "ADD\n"; // 1 OPERATION
echo $order['customers_id']."\n"; // 2 The customer ID as held in WDM
echo $order['customers_name']."\n"; // 3 Business Name
echo "1\n"; // 4 Address Format
echo "\n"; // 5 Customer Name
echo $order['delivery_street_address']."\n"; // 6 Address Line 1
echo $order['delivery_suburb']."\n"; // 7 Adddress Line 2 (Optional)
echo $order['delivery_city']."\n"; // 8 Adddress Line 3 (Optional)
echo $order['delivery_state']."\n"; // 9 Town
echo $order['delivery_postcode']."\n"; // 10 Post Code
echo "UK\n"; // 11 Country
echo "RMRFC\n"; // 12 Service ID as held in WDM
echo ""; // 13 Contract ID
die();
break;
Thanks in advance Gary
I am having some teathing problems with somne auto print label software. Very simple. Our Server generates a label via php and the user saves it to the desktop, the software recognises the file is their and prints it.
Problem I am having is this:-
If you save the file directly to the desktop the software says its a bad file. If you open the file then save it back to the desktop (without even making any changes) the software accepts the file and prints it.
I am guessing its how the php is closing the file. Can any one point me in the right direction.
Here is the code
header('Content-type: text/plain; charset=us-ascii');
header('Content-disposition: inline; filename=data.doc');
echo "ADD\n"; // 1 OPERATION
echo $order['customers_id']."\n"; // 2 The customer ID as held in WDM
echo $order['customers_name']."\n"; // 3 Business Name
echo "1\n"; // 4 Address Format
echo "\n"; // 5 Customer Name
echo $order['delivery_street_address']."\n"; // 6 Address Line 1
echo $order['delivery_suburb']."\n"; // 7 Adddress Line 2 (Optional)
echo $order['delivery_city']."\n"; // 8 Adddress Line 3 (Optional)
echo $order['delivery_state']."\n"; // 9 Town
echo $order['delivery_postcode']."\n"; // 10 Post Code
echo "UK\n"; // 11 Country
echo "RMRFC\n"; // 12 Service ID as held in WDM
echo ""; // 13 Contract ID
die();
break;
Thanks in advance Gary