From 026f49ab31924dceaa6169e52ffe71eec0acd614 Mon Sep 17 00:00:00 2001 From: Daniel Franklin Date: Tue, 31 Jan 2012 14:54:03 -0500 Subject: [PATCH] CC-3230: Show appropriate error message if disk is full when attempting to upload files via the web UI -fixed using the return result of the rename call to verifty the upload worked. --- airtime_mvc/application/models/StoredFile.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index d371d083f..9d445fa0f 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -904,10 +904,16 @@ class Application_Model_StoredFile { $audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName; Logging::log("copyFileToStor: moving file $audio_file to $audio_stor"); - //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation + $r = @rename($audio_file, $audio_stor); - + + if ($r === false) { + #something went wrong likely there wasn't enough space in the audio_stor to move the file too. + #warn the user that the file wasn't uploaded and they should check if there is enough disk space. + die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "File was not uploaded, this error will occur if the computer hard drive does not have enough disk space."}}'); + } + //$r = @copy($audio_file, $audio_stor); //$r = @unlink($audio_file); }