hello.....

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() {		
		$imgUrlArray=$this->getImageUrls($urlArray);		
		$dir="images/".$this->imagesOf;
		
		@mkdir($dir,0777);
		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);
				}
			}
		}
	}

Recommended Answers

All 2 Replies

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

$str=$this->getHtmlCode($url);
			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: 174.36.204.204)

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 10.20.30.40, but all of myFoo's web traffic goes through some kind of proxy server whose IP address is 10.11.12.13." (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

    /+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/
    QpjOd1ztB6d2qRd9h82wcdpvA1XOX-QhYlAqG8oUdiEkx1IZE
    q8bqItVGQZDhpxhw2-XbfI_lpQbshqT8zDhFnDlHDQlPCmcx2
    I_PNVXmJxxvYY6dNUry26yrkdyUcxI0FV104bq_D3xYnZJ6xs
    Uv1sZ8WNA8rRHuUkjvtIl4oBLSvLZZfTVSyBmAxMU1K302KVI
    uh45jQzjyaRmE-PocY3VpuwOMuSWkNPBR5ovJCW-ggGzGxZs1
    eWPSnYS2bzYteObfFVB6OFUswXO0EJ6dL64ZGOi56wC1_eKCu
    2K5pWyl_uSpqcobO_kNlSBd0sloG6y_SHeKbHj9AfcY26TDl-
    ySUXKcDQlBzz8Cf2roOyskMmSeKNwN5RFhpjbF9aGkND9fVVO
    STejuGvLrCp8Q2wEvVlg3FFJ-G-6cRWGMlagbZc17g3hw6mzh
    dG_eC8f0uELNWyQ3-a3qAzmOYyRDfuLFORecNHzbZoFva9oAo
    _BbsNcfbFUFqAdxav92o3bcW2nnDVMH_ubYpWQOtnVgrIP8wh
    Gsl7JbtwQSgXhEkVcFRUjV2cWdO4gTT5-DA0_BPnpRyhjxjC3
    c4n68AuEYHtMTVmbK-fyMtcWLMTVXzLpeA61O81iEDcXuGDOH
    ljl8FF_kJoCS_V5D0jO2gIO1blu5UOB9zPJ2T9yQq2AwaJfvG
    w2Y3X95Os3DTD6_RSfKqv2C7qEHHUSW38FWaKBxhsjvouPSsj
    UmMPN0g==
    +/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+

.where is the problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.