Mercurial > hg > webaudioevaluationtool
diff save.php @ 555:4cc5bc731a3d Dev_main
Added error check for empty file in save.php
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Tue, 23 Feb 2016 14:18:25 +0000 |
parents | a95d323a911e |
children | 80796ff2ae66 |
line wrap: on
line diff
--- a/save.php Tue Feb 23 12:22:28 2016 +0000 +++ b/save.php Tue Feb 23 14:18:25 2016 +0000 @@ -7,6 +7,13 @@ $datetime = date('ymdHis'); $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; $fileHandle = fopen("saves/".$xmlfile, 'w'); + if (sizeof($postText) <= 1) + { + // Filehandle failed + $xml = '<response state="error"><message>Input file empty</message></response>'; + echo $xml; + return; + } if ($fileHandle == FALSE) { // Filehandle failed @@ -27,4 +34,4 @@ // Return JSON confirmation data $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"saves/'.$xmlfile.'"</file></response>'; echo $xml; -?> \ No newline at end of file +?>