<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>sujet Intel XDk HTML5 file uploads to PHP server script dans Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Intel-XDk-HTML5-file-uploads-to-PHP-server-script/m-p/1052172#M50470</link>
    <description>&lt;P&gt;Good day,&lt;/P&gt;

&lt;P&gt;I have spent many days learning and have progressed quite a bit but I am stilling missing the plot somewhere and would appreciate your guidance.&lt;/P&gt;

&lt;P&gt;I have successfully build a number of pages that respectively can take pictures and I got a PHP server script running that receives the picture upload. One problem here is that the same image is uploaded every time and not the new picture taken.&lt;/P&gt;

&lt;P&gt;I have further successfully got the geolocation feature working perfectly&lt;/P&gt;

&lt;P&gt;Lastly&amp;nbsp;I got the QR code reader working fine.&lt;/P&gt;

&lt;P&gt;My problem is the following: I do not quite understand the concept of creating a text file and capture an image and uploading this on the same page within the app. My objective is as follows: To take a picture, add related and relevant text, then add the geolocation where the picture was taken. This I then want to upload to my web server using a PHP server side script. Lastly I need to write the info to a sql database. I would really apprectiate some guidance and/or examples.&lt;/P&gt;

&lt;P&gt;I am pastinfg the current PHP script that work for the image on the server side below&lt;/P&gt;

&lt;P&gt;&amp;lt;?php&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	ob_start();&lt;BR /&gt;
	echo "&amp;lt;pre&amp;gt;";&lt;BR /&gt;
	print_r($_FILES);&lt;BR /&gt;
	print_r($_GET);&lt;BR /&gt;
	print_r($_POST);&lt;/P&gt;

&lt;P&gt;echo "&amp;lt;/pre&amp;gt;";&lt;/P&gt;

&lt;P&gt;print_r("file type: " . $_FILES["Filedata"]["type"]);&lt;/P&gt;

&lt;P&gt;$allowedExts = array("gif", "jpeg", "jpg", "png");&lt;BR /&gt;
	$temp = explode(".", $_FILES["Filedata"]["name"]);&lt;BR /&gt;
	$extension = end($temp);&lt;BR /&gt;
	if ((($_FILES["Filedata"]["type"] == "image/gif")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/jpeg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/jpg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/pjpeg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/x-png")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/png"))&lt;BR /&gt;
	&amp;amp;&amp;amp; ($_FILES["Filedata"]["size"] &amp;lt; 9999999999)&lt;BR /&gt;
	&amp;amp;&amp;amp; in_array($extension, $allowedExts))&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; if ($_FILES["Filedata"]["error"] &amp;gt; 0)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Return Code: " . $_FILES["Filedata"]["error"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Upload: " . $_FILES["Filedata"]["name"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Type: " . $_FILES["Filedata"]["type"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Size: " . ($_FILES["Filedata"]["size"] / 1024) . " kB&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Temp file: " . $_FILES["Filedata"]["tmp_name"] . "&amp;lt;br&amp;gt;";&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; if (file_exists("upload/" . $_FILES["Filedata"]["name"]))&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; echo $_FILES["Filedata"]["name"] . " already exists. ";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; move_uploaded_file($_FILES["Filedata"]["tmp_name"],&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; "upload/" . $_FILES["Filedata"]["name"]);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; echo "Stored in: " . "upload/" . $_FILES["Filedata"]["name"];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	else&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; echo "Invalid file";&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; $data=ob_get_clean();&lt;BR /&gt;
	$fp=fopen("debug.txt","w+");&lt;BR /&gt;
	fputs($fp,$data);&lt;BR /&gt;
	fclose($fp);&lt;BR /&gt;
	?&amp;gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jan 2015 14:17:08 GMT</pubDate>
    <dc:creator>Zack_S_</dc:creator>
    <dc:date>2015-01-15T14:17:08Z</dc:date>
    <item>
      <title>Intel XDk HTML5 file uploads to PHP server script</title>
      <link>https://community.intel.com/t5/Software-Archive/Intel-XDk-HTML5-file-uploads-to-PHP-server-script/m-p/1052172#M50470</link>
      <description>&lt;P&gt;Good day,&lt;/P&gt;

&lt;P&gt;I have spent many days learning and have progressed quite a bit but I am stilling missing the plot somewhere and would appreciate your guidance.&lt;/P&gt;

&lt;P&gt;I have successfully build a number of pages that respectively can take pictures and I got a PHP server script running that receives the picture upload. One problem here is that the same image is uploaded every time and not the new picture taken.&lt;/P&gt;

&lt;P&gt;I have further successfully got the geolocation feature working perfectly&lt;/P&gt;

&lt;P&gt;Lastly&amp;nbsp;I got the QR code reader working fine.&lt;/P&gt;

&lt;P&gt;My problem is the following: I do not quite understand the concept of creating a text file and capture an image and uploading this on the same page within the app. My objective is as follows: To take a picture, add related and relevant text, then add the geolocation where the picture was taken. This I then want to upload to my web server using a PHP server side script. Lastly I need to write the info to a sql database. I would really apprectiate some guidance and/or examples.&lt;/P&gt;

&lt;P&gt;I am pastinfg the current PHP script that work for the image on the server side below&lt;/P&gt;

&lt;P&gt;&amp;lt;?php&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	ob_start();&lt;BR /&gt;
	echo "&amp;lt;pre&amp;gt;";&lt;BR /&gt;
	print_r($_FILES);&lt;BR /&gt;
	print_r($_GET);&lt;BR /&gt;
	print_r($_POST);&lt;/P&gt;

&lt;P&gt;echo "&amp;lt;/pre&amp;gt;";&lt;/P&gt;

&lt;P&gt;print_r("file type: " . $_FILES["Filedata"]["type"]);&lt;/P&gt;

&lt;P&gt;$allowedExts = array("gif", "jpeg", "jpg", "png");&lt;BR /&gt;
	$temp = explode(".", $_FILES["Filedata"]["name"]);&lt;BR /&gt;
	$extension = end($temp);&lt;BR /&gt;
	if ((($_FILES["Filedata"]["type"] == "image/gif")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/jpeg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/jpg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/pjpeg")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/x-png")&lt;BR /&gt;
	|| ($_FILES["Filedata"]["type"] == "image/png"))&lt;BR /&gt;
	&amp;amp;&amp;amp; ($_FILES["Filedata"]["size"] &amp;lt; 9999999999)&lt;BR /&gt;
	&amp;amp;&amp;amp; in_array($extension, $allowedExts))&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; if ($_FILES["Filedata"]["error"] &amp;gt; 0)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Return Code: " . $_FILES["Filedata"]["error"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Upload: " . $_FILES["Filedata"]["name"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Type: " . $_FILES["Filedata"]["type"] . "&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Size: " . ($_FILES["Filedata"]["size"] / 1024) . " kB&amp;lt;br&amp;gt;";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; echo "Temp file: " . $_FILES["Filedata"]["tmp_name"] . "&amp;lt;br&amp;gt;";&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; if (file_exists("upload/" . $_FILES["Filedata"]["name"]))&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; echo $_FILES["Filedata"]["name"] . " already exists. ";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; move_uploaded_file($_FILES["Filedata"]["tmp_name"],&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; "upload/" . $_FILES["Filedata"]["name"]);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; echo "Stored in: " . "upload/" . $_FILES["Filedata"]["name"];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	else&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; echo "Invalid file";&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; $data=ob_get_clean();&lt;BR /&gt;
	$fp=fopen("debug.txt","w+");&lt;BR /&gt;
	fputs($fp,$data);&lt;BR /&gt;
	fclose($fp);&lt;BR /&gt;
	?&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 14:17:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Intel-XDk-HTML5-file-uploads-to-PHP-server-script/m-p/1052172#M50470</guid>
      <dc:creator>Zack_S_</dc:creator>
      <dc:date>2015-01-15T14:17:08Z</dc:date>
    </item>
    <item>
      <title>In order to capture images</title>
      <link>https://community.intel.com/t5/Software-Archive/Intel-XDk-HTML5-file-uploads-to-PHP-server-script/m-p/1052173#M50471</link>
      <description>&lt;P&gt;In order to capture images from your device's camera, I recommend using the &lt;A href="http://plugins.cordova.io/#/package/org.apache.cordova.camera"&gt;Apache Cordova* Camera plugin API&lt;/A&gt;. In regards to getting the use's location, consider using the &lt;A href="http://plugins.cordova.io/#/package/org.apache.cordova.geolocation"&gt;Apache Cordova* Geolocation plugin API&lt;/A&gt;. For developing a project that upload data to a server, visit&amp;nbsp;&lt;A href="http://www.ibm.com/developerworks/library/wa-html5db/"&gt;http://www.ibm.com/developerworks/library/wa-html5db/&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 20:43:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Intel-XDk-HTML5-file-uploads-to-PHP-server-script/m-p/1052173#M50471</guid>
      <dc:creator>Elroy_A_Intel</dc:creator>
      <dc:date>2015-01-23T20:43:47Z</dc:date>
    </item>
  </channel>
</rss>

