Jump to content

Help with uploads


nizuya

Recommended Posts

I'm installing wordpress on my website to manage news content. I will not be the only one updating the content, there will also be other, non-programmer, users. As such I need the admin side web-based media uploading to work properly.

 

The website is hosted on a University virtual server and I am not able to change any setting like in php.ini

 

Part of the website is located in a private https protected folder and part is public.

 

Uploads should be saved in public portion of the website. Permissions on the "uploads" directory of the website are set to 777.

 

I have little experience working with web based uploading. I wrote a simple upload script just to try and troubleshoot the issues:

 

if ($_FILES["file"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else {
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp location: " . $_FILES["file"]["tmp_name"] . "<br />";

if (file_exists("uploads/" . $_FILES["file"]["name"])) {
	echo $_FILES["file"]["name"] . " already exists. ";
}
else {
	$result = move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
	if (!$result) {
		echo "Failed";
	}
	else {
		echo "Saved in: " . "uploads/" . $_FILES["file"]["name"];
	}
}
}

 

The output seems to be successful as the page displays "Saved in: uploads/filename.xyz". However, the file does NOT get copied to the uploads dir.

 

Any idea what could be going on?

 

Thanks,

David

Link to comment
https://forums.phpfreaks.com/topic/196140-help-with-uploads/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.