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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.