0

Hi everyone,

I'm using move_upload_function for uploading file. I works fine on localhost but, it doesn't work on live server.

Thank in advance..

3
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by javedsai
0

show your code. Is the destination directory writable?

0
if ($_FILES['image']['name'] != "")
		{
			$ext = explode(".",$_FILES['image']['name']);
			$extension = strtolower($ext[1]);
			
			
			if ($extension =="jpg" || $extension =="jpeg" || $extension =="png" || $extension == "gif")
			{
				include("class/resize-class.php");
				
				$action = "auto";
				$width_thumb = 148;//output for portrait 119px && for landscape it is 148px
				$height_thumb = 148;//output for portrait 148px && for landscape it is 128px
				$width_medium = 340;//output for portrait 273px && for landscape it is 340px
				$height_medium = 340;//output for portrait 340px && for landscape it is 296px	
				
				 $file_name = time().".".$extension;
				$target_path = './orig_img/'.$file_name;				
				
				
				
						if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path))
						{
							echo "Image Uploaded Successfully!!";
							
						}//EO if(move_uploaded_file($_FILES['upload']['tmp_name'], $target_orig))
						else
						{
							$error_msg[] = "Problem Occured While uploading image";
							
						}
				
			}//EO if ($extension =="jpg" || $extension =="jpeg" || $extension =="png" || $extension == "gif")
			else
			{
				$error_msg[] = "Please Upload only jpg, jpeg, png or gif formats for image";

			}			
			
			
		}//EO if ($_FILES['image']['name'] != "")
0

Thx my freind. The folder was not having write permission. I gave read, write, execute permission to all options i.e. Owner Permissions, Group Permissions & Public Permissions

0

//EDIT

Solution posted as I was typing:

show your code. Is the destination directory writable?

As I thought.

Please mark as solved.

Edited by diafol: n/a

0

Thx my freind. The folder was not having write permission. I gave read, write, execute permission to all options i.e. Owner Permissions, Group Permissions & Public Permissions

if you set write permisons to public that mean that ANYONE can write files to dir.
You don't want that.

0

You mean that, I should give write permission to only Owner & Group?

This question has already been answered. 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.