diff --git a/epub.php b/epub.php
index e56b0b6..13eeec3 100644
--- a/epub.php
+++ b/epub.php
@@ -19,10 +19,17 @@
function write_epub($epub)
{
- if ( ! $epub->error ) {
+ if (file_exists($epub->epub_file))
+ {
+ unlink($epub->epub_file);
+ }
+
+ if (!$epub->error)
+ {
$epub->CreateEPUB();
- if ( ! $epub->error ) {
+ if (!$epub->error)
+ {
echo 'Success: ' . $epub->epub_file . ' created.
';
}
else
@@ -30,7 +37,9 @@
echo $epub->error;
}
- } else {
+ }
+ else
+ {
echo $epub->error;
}
}