Mercurial > hg > webaudioevaluationtool
changeset 1855:03b876101f05
Added error check for empty file in save.php
author | Giulio Moro <giuliomoro@users.noreply.github.com> |
---|---|
date | Tue, 23 Feb 2016 14:18:25 +0000 |
parents | 2d3ce9d4ca5e |
children | 96b83aa64be3 |
files | save.php |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
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 +?>