How can I send errors caused in back-end PHP file of Uploadify to the uploading form? Right now when I have an error to report to the user from PHP I just echo and it goes to the onComplete method of Uploadify and alerts the user. Please see below:
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
}
if ($error) // I want to show this error on uploading form page.
{
echo "Some error";
}
else
{
echo '1';
}
?>
and I get the error like:
'onComplete': function(a, b, c, data, e){
alert(data);
}
- The problem is that I want to get Only error, but it will print "1" if there is no error. I want to print only if there is any error, otherwise dont print 1.
- How can i append the error data on the page instead of alert?
Thanks