Project

General

Profile

« Previous | Next » 

Revision a2bb4586

Added by Scott Ullrich over 17 years ago

edit.php show an error on opening an empty file

Ticket #1519

View differences:

usr/local/www/edit.php
31 31

  
32 32
if (($_GET['submit'] == "Load") && file_exists($_GET['savetopath'])) {
33 33
	$fd = fopen($_GET['savetopath'], "r");
34
	$content = fread($fd, filesize($_GET['savetopath']));
34
	if ((filesize($_GET['savetopath']) != 0)) {  $content = fread($fd, filesize($_GET['savetopath'])); } else { $content = ""; }
35 35
	fclose($fd);
36 36
	$edit_area="";
37 37
	$loadmsg = gettext("Loaded text from")." " . $_GET['savetopath'];
......
49 49

  
50 50
if (($_POST['submit'] == "Load") && file_exists($_POST['savetopath'])) {
51 51
	$fd = fopen($_POST['savetopath'], "r");
52
	$content = fread($fd, filesize($_POST['savetopath']));
52
	if ((filesize($_POST['savetopath']) != "0")) {  $content = fread($fd, filesize($_POST['savetopath'])); } else { $content = ""; }
53 53
	fclose($fd);
54 54
	$edit_area="";
55 55
	$loadmsg = "Loaded text from " . $_POST['savetopath'];

Also available in: Unified diff