Jump to content

dhmyers82

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dhmyers82

  • Rank
    Member
  1. When it is a .php file with a form and the action calls itself. The validations are running before the user even has a chance to enter in any data. I just reread the question and I think they should be separate files with all the data being appended to a "single" .txt file
  2. Sorry, where would you like me to post questions like this?
  3. Please tell me if I am thinking correctly I have a .html doc with a form. The form has an action calling a php file. The action is called when I hit submit. How does it work with an all-in-one form? Why is the php running as the page loads and not when I hit submit?
  4. When checking validity do I want to stripslashes before or after I check?
  5. I have no idea what it was doing. I came back to it and re-uploaded it and it is working fine. Thank you all for looking it over.
  6. I keep getting this error "Parse error: syntax error, unexpected '=' in /home/143/dmyers/public_html/sdev253/php/FileDownloader.php on line 4" How is the '=' not needed. Its straight from the stupid book... I hate php today <?php $dir = "files"; if (isset($_GET['filename'])) { $fileToGet = $dir. "/" .stripcslashes($_GET['filename']); if (is_readable($fileToGet)) { header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"" .$_GET['filename']. "\""); header("Content-Transfer-Encoding: base64"); header("Content-Length: " .filesize($fileToGet)); readfile($fileToGet); $showErrorPage = FALSE; } else { $errorMsg = "Cannot read \"$fileToGet\""; $showErrorPage = TRUE; } } else { $errorMsg = "No filename specified"; $showErrorPage = TRUE; } if ($showErrorPage) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "html://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>File Downloader</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <p>There was an error downloading "<?php echo htmlentities($_GET['filename']); ?></p> <p><?php echo htmlentities($errorMsg); ?></p> </body> </html> <?php } ?>
  7. Thanks it was not saved as a .php and I know the HTML format has no bearing on it working. I have just had people tell me I need to be using HTML5 instead of XHTML, I was just trying to avoid more comments of that nature.
  8. There has to be an error in the php that I am not seeing as I am getting php script echoed in the top of the document. Also It is not finding the server. I dont know if this is becaus of the error I can't find or something else. Yes I know it is in XHTML. I am using an outdated book. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "html://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>[TEMPLATE]</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', 'on'); $dir = "files"; if (isset($_POST['upload'])) { if (isset($_FILES['new_file'])) { if (move_uploaded_file($_FILES['new_file']['tmp_name'], $dir. "/" .$_FILES['new_file']['name']) == True) { chmod($dir. "/" .$_FILES['new_file']['name'], 0644); echo "File \"" .htmlentities($_FILES['new_file']['name']). "\"successfully uploaded.<br />\n"; } else echo "There was an error uploading \"" .htmlentities($_FILES['new_file']['name']). "\".<br />\n"; } } ?> <form action="FileUploader.php" method="POST" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="25000" /><br /> File to upload:<br /> <input type="file" name="new_file" /><br /> (25000 byte limit) <br /> <input type="submit" name="upload" value="Upload the File" /> <br /> </form> </body> </html> Thank you for the help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.