Ninjakreborn Posted November 1, 2006 Share Posted November 1, 2006 So in it's basic form, I can do this with a fileif (isset($_POST['file1'])) {$newname = "Some system to rename file's";rename ($_FILES['file1']['tmp_name'], $newname);move_uploaded_file($newname, "path");}something along those line's for just renaming a file that just got uploaded, then moving it to the proper directory. Link to comment Share on other sites More sharing options...
trq Posted November 1, 2006 Share Posted November 1, 2006 Is this meant to be a question? Maybe someone needs to have a read of the link in my signiture. Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 1, 2006 Author Share Posted November 1, 2006 Sorry about that, I was thinking about starting to use the rename function and was wondering about it, but I decided not to use that, but to use something else. Link to comment Share on other sites More sharing options...
gmwebs Posted November 1, 2006 Share Posted November 1, 2006 [code]<?php// List of our known file types$known_file_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png' );if(!array_key_exists($photos_uploaded['type'], $known_file_types)) { echo "This file type is not allowed to be uploaded...";} else { // Fetch the photo array sent by adminconsole.php $files_uploaded = $_FILES['upload_file']; //This is the name of your file upload field on the form $filetype = addslashes($files_uploaded['type']); $extension = $known_file_types[$filetype]; // Generate the filename $filename = time(); $filename = $filename.".".$extension; // Store the orignal file move($files_uploaded['tmp_name'], "/uploads/".$filename);}?>[/code] Link to comment Share on other sites More sharing options...
trq Posted November 1, 2006 Share Posted November 1, 2006 Well I'll just close this topic then. Link to comment Share on other sites More sharing options...
Recommended Posts