GremlinP1R Posted October 18, 2006 Share Posted October 18, 2006 Can some one please HELP ME.......Okay got it to work but the extention is a problem.... for some reason it does not pick it up....This is what I have...[code]<?php// Validation of File Extension function validate_extension() { // Section #1 - Defining variabels $file_name = trim($this -> file_name); $extension = strtolower(strrchr($file_name, ".")); $ext_array = $this -> ext_array; $ext_count = count($ext_array); // Section #2 - Validate File Name and Extension if (!$file_name) { return false; } else { if (!$ext_array){ return true;} else { foreach ($ext_array as $value) { $first_char = substr($value, 0, 1); if ($first_char <> ".") { $extensions[] = "." .strtolower($value); } else { $extensions[] = strtolower($value); } } // Section #3 - Loop using right extension - Check for acceptance foreach ($extensions as $value) { if ($value == $extension) { $valid_extension = "TRUE" ; } } // Section #4 - if ($valid_extension) { return true; } else { return false;} } } }?>[/code]it keeps on telling me that the extention is undefined.... and the how do I make this loop??[code]<?php// When Submitting if (isset($_POST['Submit'])) { include('uploadclass.php'); // Set upload info $upload_class = new Upload_Files; $upload_class -> temp_file_name = trim($_FILES['pic1']['tmp_name']); $upload_class -> file_name = trim(strtolower($_FILES['pic1']['name'])); $upload_class -> upload_dir = "images/cars/"; $upload_class -> upload_log_dir = "images/uploadlog/"; $upload_class -> max_file_size = 500000000; $upload_class -> banned_array = array(" "); $upload_class -> ext_array = array(" .jpg"); // Calling class Functions// $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(); $upload_directory = $upload_class -> get_upload_directory(); $upload_log_directory = $upload_class -> get_upload_log_directory(); $upload_file = $upload_class -> upload_file_no_validation();?>[/code]as I have 4 pics to upload at the same time....Thanx Quote Link to comment Share on other sites More sharing options...
GremlinP1R Posted October 18, 2006 Author Share Posted October 18, 2006 Any one please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.