Reply to Re: Destination directory can't be created. Can't carry on a process

Re: Destination directory can't be created. Can't carry on a process new!
by Luca, 17 years, 3 months ago
Nothing... It doesn't work.This is my code:

$folder="/domains/mysite.com/public_html/main/staff/images/pets/"; 
	
if(ftp_chmod($conn_id, 0777, $folder)) {
    
    // we create an instance of the class, giving as argument the PHP object 
    // corresponding to the file field from the form
    // All the uploads are accessible from the PHP object $_FILES
    $handle = new Upload($_FILES['my_field']);

    // then we check if the file has been uploaded properly
    // in its *temporary* location in the server (often, it is /tmp)
    if ($handle->uploaded) {
            
        // yes, the file is on the server
        // below are some example settings which can be used if the uploaded
        // file is an image.
        $handle->file_new_name_body = $_POST["name"];
        $handle->image_resize       = true;
        $handle->image_y        	= 60;
        $handle->image_ratio_x      = 100;
        $handle->image_convert      = 'jpg';
        $handle->jpeg_quality       = 80;
        
        // now, we start the upload 'process'. That is, to copy the uploaded file
        // from its temporary location to the wanted location
        // It could be something like $handle->Process('/home/www/my_uploads/');
        $handle->Process("".$folder."");
            
        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !
            ftp_chmod($conn_id, 0755, $folder);
            ftp_close($conn_id);
            header("Location: true.php");
            exit;
        } else {
            $errors= $handle->error;
            mail('mymail@mysite.com','errors',$errors); 
            ftp_chmod($conn_id, 0755, $folder);
            ftp_close($conn_id);
            // one error occured
            header("Location: false.php");
            exit;
        }
    }
}

I think the error is in the /tmp directory that I don't have. Is the directory that you talk about in your commented code:

// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)

Can you help me?

Thank youReply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important