Page 1 of 1

is_upload_file problem

Posted: Thu Aug 15, 2002 9:16 am
by ssand
Hi all,

I am trying to get a simple upload page to work and one of the problems I am having is checking to see if the file already exists.

Code: Select all

Currently using:

	if (!is_uploaded_file($userfile))
		{
			$error="Upload Problem: possible file attack.";
			echo "<font class=maintext>$error</font>";
			exit;
		&#125;
Which doesn't seem to work - as it lets multiple uploads of the same file name. Do I need to specify the path to the uploads dir somewhere within this code (/usr/local/apache/htdocs/apcenter/uploads/)?

Or is this not really the best way to check for an existing file before uploading?

Thanks - Steve

Posted: Thu Aug 15, 2002 9:18 am
by fatalcure
ur using the wrong code to check if a file exists ;)

Code: Select all

if (file_exists($userfile)) echo "File Already Exists...";
else &#123;
    //upload it here
&#125;
:)

Thanks

Posted: Thu Aug 15, 2002 9:24 am
by ssand
Thanks! Works great. :D

Steve