Destination directory can't be created. Can't carry on a process

See all posts See thread Reply

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
Re: Destination directory can't be created. Can't carry on a process new!
by colin, 17 years, 3 months ago
The /tmp directory is set in your php.ini. If you don't have a tmp directory, then you won't be able to upload at all.

The class doesn't try to create the temporary directory. It merely uses it. PHP, for security reason, uploads the file itself into this temp directory, from which is is available to the class (is_uploaded_file() and move_uploaded_file())

I would recommend checking if a simple bit of upload code works, so to make sure that your hosting allows uploads. You can find such code there: http://www.php.net/features.file-uploadReply
Re: Destination directory can't be created. Can't carry on a process new!
by anonymous, 10 years, 1 month ago
Hi,

It was working fine but all of a suddon i get the same error. i have changed nothing in the php files.Reply