0

hello,
i have used the following code for file upload:

$id=100;

$upload_dir = "images/";

do
{
		$photo = $_FILES['photo'];
		
		switch($photo['error'])
		{
			case UPLOAD_ERR_INI_SIZE:
				$err2 = "Server doesn't allow the image size.. Please select a smaller one..";
				break 2;
			case UPLOAD_ERR_PARTIAL:
				$err2 = "The image was not transferred successfully..";
				break 2;
			case UPLOAD_ERR_NO_FILE:
				break 2;
			case UPLOAD_ERR_FORM_SIZE:
				$err2 = "The size of the image was too large..";
				break 2;
			case UPLOAD_ERR_OK:
				break;
			default:
				$err2 = "Some error occured while uploading the image..";
				break;
		}

		$ext = substr(strrchr($photo['name'], "."),1);
		if(!($ext == "bmp" || $ext == "jpg" || $ext == "jpeg" || $ext == "jpe" || $ext == "gif" || $ext == "png"))
		{
			$err2 = "Invalid image type.. Please select a JPG, BMP, GIF or PNG image..";
			break;
		}

		$upload_path = $upload_dir . $id . "." . $ext;
		if(!@move_uploaded_file($photo['tmp_name'], $upload_path))
		{
			$err2 = "Error moving file to its destination..";
		}
		
}
while(0);	

print "" . $err2;


The html code is like:

<form name="addartcraft" action="activities.php?sub=artcraft" enctype="multipart/form-data" method="post">
	<input type="hidden" name="MAX_FILE_SIZE" value="5242880" />
	<input type="file" name="photo" />
	<input name="addartcraft" type="submit" value="Save" />
</form>


This works perfectly on my localhost..

But when i uploaded the site, the error occurs..

i have subscribed web space on Yahoo!

in Yahoo! file manager, the uploaded file is shown, but it doesn't be opened..

The screenshot is attached..

Attachments yahoo_error_3.png 138.69 KB
2
Contributors
2
Replies
6
Views
7 Years
Discussion Span
Last Post by JigneshManek
0

The directory's access permission is Public already..

and i also tried chmod(), but didnt find the solution..

Screenshot:

Attachments yahoo_error_4.png 161.26 KB
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.