Jump to content

jchase

Members
  • Posts

    2
  • Joined

  • Last visited

jchase's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. jchase

    File uplaod problem

    Thanks,Yea that's a problem too, but I also forgot to include enctype="multipart/form-data" in the form declaration. That fixed the problem.
  2. jchase

    File uplaod problem

    I am currently trying to set up a system on my site for users to upload an avatar for their account. In testing when I choose a file to upload and press my submit button and then in the script I try to access the file via the $_files variable none of the file array values exisit. I am not really sure why these values do not exisit. I have checked the php_info() and file_uploads is set to on and the max_file_size is set to 8mb. Any help you could offer would be greatly appreciated!Thanks!My Code: //HTML tags<form method="post" name="form" action="<?php echo $_SERVER['../PHP_SELF']; ?>"><input type="hidden" name="form4"><table><tr><td>Your Icon </td><td><input type="file" name="myIcon"></td><td><input type="submit" value="Submit Icon"></td></tr></table> //php if(isset($_POST["form4"])) {require_once("../includes/upload_files.php");$upload_class = new upload_files;$upload_class->temp_file_name = trim($_FILES['myIcon']['tmp_name']);$upload_class->file_name = trim(strtolower($_FILES['myIcon']['name']));$file = $_FILES['myIcon']['name'];$upload_class->upload_dir = "avatars/";$upload_class->upload_log_dir = "avatars/upload_logs/";$upload_class->max_file_size = 5242880;$upload_class->banned_array = array("");$upload_class->ext_array = array(".jpg",".gif",".png",".bmp");$valid_ext = $upload_class->validate_extension();$valid_size = $upload_class->validate_size();$valid_user = $upload_class->validate_user();$max_size = $upload_class->get_max_size();$file_size = $upload_class->get_file_size();$file_exists = $upload_class->existing_file();if (!$valid_ext) {$result = "The file extension is invalid, please try again!";}else if (!$valid_size) {$result = "The file size is invalid, please try again! The maximum file size is: $max_size and your file was: $file_size";}else if (!$valid_user) {$result = "You have been banned from uploading to this server.";}else if ($file_exists) {$result = "This file already exists on the server, please try again.";} else {$upload_file = $upload_class->upload_file_with_validation();if (!$upload_file) {$result = "Your file could not be uploaded!";} else {$result = "Your file has been successfully uploaded to the server."; }}echo $result;
×
×
  • Create New...