Mercurial > hg > webaudioevaluationtool
comparison save.php @ 1214:dc4300033afc
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 | 47bfd9594617 |
children | 5df87aa95395 |
comparison
equal
deleted
inserted
replaced
1213:69394f0fd142 | 1214:dc4300033afc |
---|---|
5 $postText = file_get_contents('php://input'); | 5 $postText = file_get_contents('php://input'); |
6 $sha1_hash = sha1($postText); | 6 $sha1_hash = sha1($postText); |
7 $datetime = date('ymdHis'); | 7 $datetime = date('ymdHis'); |
8 $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; | 8 $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; |
9 $fileHandle = fopen("saves/".$xmlfile, 'w'); | 9 $fileHandle = fopen("saves/".$xmlfile, 'w'); |
10 if (sizeof($postText) <= 1) | |
11 { | |
12 // Filehandle failed | |
13 $xml = '<response state="error"><message>Input file empty</message></response>'; | |
14 echo $xml; | |
15 return; | |
16 } | |
10 if ($fileHandle == FALSE) | 17 if ($fileHandle == FALSE) |
11 { | 18 { |
12 // Filehandle failed | 19 // Filehandle failed |
13 $xml = '<response state="error"><message>Could not open file</message></response>'; | 20 $xml = '<response state="error"><message>Could not open file</message></response>'; |
14 echo $xml; | 21 echo $xml; |