i am using this function to create a folder in images folder. all uploaded images are store in newly created folder.it is working fine when run the code..it is creating images/newfoldername/uploadedimages.jpg in localhost. but in server same code is not working. it is creating images/uploadedimages.jpg and also creating null folder images/newfolder. there is nothing files in images/newfoldername/uploadedimages.jpg. where is the problem in server?

public function downloadImages() {		
		for($i=0; $i<count($imgUrlArray); $i++) {
			$imageName = basename($imgUrlArray[$i]);
			$info = @getimagesize($imgUrlArray[$i]);
			if(trim($this->sizeLimit) != "" && $this->sizeLimit > 0) {
				if (count($info) > 0 && $info[0] >= $this->sizeLimit) {
					if(trim($imageName) != '' ) {
						copy($imgUrlArray[$i], $dir."/".$imageName);
			else {
				if(trim($imageName) != '' ) {
					copy($imgUrlArray[$i], $dir."/".$imageName);

Permissions, Permissions, Permissions....
When the code is running from the Apache server the folder that you are trying to create the new directory in has to be writeable by the apache user or group. Make the group owner Apache (or your apache user group name) and chmod the directory to 775 so that it is writeable by members of the apache group.

drw-rw-r-- mydomainuser apache 4096 2010-10-10 05:59 mynewdir

thanks for your reply. i am using this code to know how to get google images from my site..actually the problem is i am not getting google images to array from my server.
i was run this code in my localhost. it is working fine. but not in my server. getting 403forbidden error. in this page downloadimagesfromgoogle.inc.php at getImageUrls() i checked like this

			echo $str;

then it is redirecting to google images. but in my server getting this error.."google error forbidden"

Your client does not have permission to get URL /images?q=rings&hl=en&lr=&start=0&sa=N&gbv=1 from this server. (Client IP address:

Please see Google's Terms of Service posted at http://www.google.com/terms_of_service.html

If you believe that you have received this response in error, please report your problem. However, please make sure to take a look at our Terms of Service (http://www.google.com/terms_of_service.html). In your email, please send us the entire code displayed below. Please also send us any information you may know about how you are performing your Google searches-- for example, "I'm using the Opera browser on Linux to do searches from home. My Internet access is through a dial-up account I have with the FooCorp ISP." or "I'm using the Konqueror browser on Linux to search from my job at myFoo.com. My machine's IP address is, but all of myFoo's web traffic goes through some kind of proxy server whose IP address is" (If you don't know any information like this, that's OK. But this kind of information can help us track down problems, so please tell us what you can.)

We will use all this information to diagnose the problem, and we'll hopefully have you back up and searching with Google again quickly!

Please note that although we read all the email we receive, we are not always able to send a personal response to each and every email. So don't despair if you don't hear back from us!

Also note that if you do not send us the entire code below, we will not be able to help you.

Best wishes,
The Google Team


.where is the problem?