Forum Topic: Naming uploaded files?

(108 views • 1 reply)

This topic is 1 page long.

<< < > >>
None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 5/1/09 01:49 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

<?php
	if($_FILES['file']['error']==0){
		if($_FILES['file']['type']=='image/gif'||$_FILES['file']['type']=='image/png'||$_FILES['file']['size']>13333337){
			move_uploaded_file($_FILES['file']['tmp_name'],'./images/'.$_FILES['file']['name']);
			echo 'The file is located <a href="./images/'.$_FILES['file']['name'].'">Here</a>';
		}elseif(file_exists('./'.$_FILES['file']['name'])){
			echo 'This file already exists; Please upload another';
		}else{
			echo 'Incorrect file type; Must be a GIF or PNG image';
		}
	}else{
		'There was an error with your upload; '.$_FILES['file']['error'];
	}
?>

That's the code I have for uploading, but how do I rename the files after they are uploaded and before I move them?

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

WoogieNoogie

Reply To Post Reply & Quote

Posted at: 5/1/09 10:41 PM

WoogieNoogie LIGHT LEVEL 14

Sign-Up: 06/26/05

Posts: 3,284

$_FILES['data']['name'] = putstuffhere

All times are Eastern Standard Time (GMT -5) | Current Time: 08:03 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!