Old 9th December 2007, 07:12
bradhawk bradhawk is offline
Join Date: Nov 2007
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Exclamation PHP File Upload Problem

Hi I'm trying to write a php script that will upload files to the server.

I do have ISPConfig installed but I think that I've changed things in the necessary areas to not have problems with ISPConfig.

Here is the script:
<meta http-equiv="content-type" content="text/html"; charset="iso-8859-1" />
<title>Uploading Files...</title>
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);

		echo "<pre>";
		echo "</pre>";

	if(move_uploaded_file($_FILES['thefile']['tmp_name'], "Proposal/{$_FILES['thefile']['name']}"))
		print '<p>Your file has been uploaded successfully!</p>';
		print '<p>Your file could not be uploaded because: <b><br>';
		print 'Temp Name: ';
		print "{$_FILES['thefile']['tmp_name']}";
		print '<br>';
		print 'Name: ';
		print "{$_FILES['thefile']['name']}";
		print '<br>';


			case 1:
				print 'The file exceeds the upload_max_filesize setting in php.ini';
			case 2:
				print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
			case 3:
				print 'The file was only partially uploaded';
			case 4:
				print 'No file was uploaded';
			case 6:
				print 'No temp directory found';
			case 7:
				print 'Cannot write file to specified location';
			case 8:
				print 'Extension not valid';
		print '</b></p>';

<form name = "uploader" method = "post" action = "Upload.php" enctype = "multipart/form-data">
<p>Upload a file using this form: <br/><br/>
<input type = "hidden" name = "MAX_FILE_SIZE" value = "3000" />
<input type = "file" name = "thefile" /><br/><br/>
<input type = "submit" name = "submit" value = "Upload File" />
When I run this I have the error 6 come up. The error that says there is no temporary directory. Also the $_FILES['thefile']['tmp_name'] value is empty.

I don't know what I'm doing wrong. The temporary directory has permissions 777 and I've set the temporary directory. I've looked through php.ini and can't see any problems. Anyone have any suggestions? Thanks!
Reply With Quote
Sponsored Links
Old 10th December 2007, 09:04
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts

What's the output of the print_r($_FILES); line?
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Old 11th December 2007, 09:09
bradhawk bradhawk is offline
Join Date: Nov 2007
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts

I fixed the problem by changing the upload_tmp_dir from /var/www/phptemp to /tmp. Don't know what it didn't work with the other directory.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 10:29
Installations Problem @ PHP thryb Installation/Configuration 1 7th November 2007 14:41
php eating cpu shajazzi Server Operation 15 15th August 2007 02:19
Apache2 Freezes celtic Server Operation 31 28th May 2007 18:18
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 06:19

All times are GMT +2. The time now is 01:07.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.