Jump to content

Problem uploading images to my server


bindiya

Recommended Posts

I have a php website  with two parts the client part and an admin part

in the client part or the viewers end , i need to show the details of products  with description and an image (in the front page).

The details are entered though the admin part.

 

My problem is the image uploaded goes to the folder in the admin folder but in the home page the images are taken from the images folder suitated in outside the admin folder . How can i upload images or photos to the folder outside the admin though the admin pages.

Pasting my code here

 

$target = "pics/";  [color=red]//this is created in the admin folder, i need to change here that is keep the folder outside the admin folde[/color]r
						 $target = $target . basename( $_FILES['photo']['name']);
						 $pic=($_FILES['photo']['name']);
						  $image=$pic;
                                                          $box_num =$_POST['box_num'];
				                   $query11 = "update photo_table set  page_head='$page_head',image='$image' where id='$box_num'";
						  $result11 = mysql_query($query11);

		  if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { 
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } 
   }else { 
    
	 echo "Sorry, there was a problem uploading your file.";
	  } 
}
  }




 

Link to comment
Share on other sites

I am making more clear abvout the above doubt.

The image upload is done by the admin. and the admin is  able to upload images to the  admin/images folder .But admin  wants the images to be uploaded to the www.abc.html/images folder.

 

Posting the code again




$target = "pics/";  [color=red]//this is created in the admin folder, i need to change here that is keep the folder outside the admin folde[/color]r
						 $target = $target . basename( $_FILES['photo']['name']);
						 $pic=($_FILES['photo']['name']);
						  $image=$pic;
                                                          $box_num =$_POST['box_num'];
				                   $query11 = "update photo_table set  page_head='$page_head',image='$image' where id='$box_num'";
						  $result11 = mysql_query($query11);

		  if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { 
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } 
   }else { 
    
	 echo "Sorry, there was a problem uploading your file.";
	  } 
}
  }

 

Any idea?? I just made my doubt so simple, please dont consider this as a re posting. :)

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.