Hi All,
I'm pretty much a PHP newbie and I'd appreciate it if someone could take a look at this code to see where my error is. I've been banging my head on my desk for so long now I can barely see my monitor due to the swelling :-(
The problem (I believe) is in the if (!isset($_POST['form_data'])) because when I try uploading an image to my server, regardless of if I have specified a file or not I get a "no data" error.
I appreciate any help anyone can give!
<?php
if (isset($_POST['submit'])) {
if (!isset($_POST['form_data'])) { // check for data
echo "no data"; // no data - return error
exit;
}
else {
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
echo "data processed";
}
}
else { // else show the form to submit new data:
?>
<form method="POST" action="<?=$PHP_SELF; ?>" enctype="multipart/form-data">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="20000">
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?
}
?>
JeNNiDeS