Download & Extend

Blank Filefield Causes Deployment Error

Project:Deployment
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:devinfoley
Status:postponed (maintainer needs more info)

Issue Summary

I have a CCK type called "Feature" that has an optional image field. If I create a Feature and attach an image to it, deployments work fine. However, if I attempt to deploy a Feature with no image attached, I get the following error in the Deployment Log Details:

filefield File: Error Could not create destination directory for file.

I'm assuming the code needs to check for a value in the image field before attempting to deploy it.

Comments

#1

Assigned to:Anonymous» devinfoley
Status:active» patch (to be ported)

Ok, I found the problem was with filefields that accept multiple values. In this case, the value of $node->{$field} would not be empty, but would instead contain an empty array. I've attached a patch that fixes the problem.

AttachmentSizeStatusTest resultOperations
deploy-filefield-multiple.patch849 bytesIgnored: Check issue status.NoneNone

#2

There is another problem with multiple values in filefield. When you have several values in form as default, then form sets null in files array. You need to check in foreach if $file is not a null, if does then continue.

#3

I get same error message "Could not create destination directory for file." when trying to deploy a content type with 1 optional ImageField. Although, I only get the error when there is an image attached.

#4

ahabman, maybe this helps:
I had this error with content types that have an imagefield (filefield)
(I have the imagefield limited to max 1 image)

* warning: fopen() [function.fopen]: Filename cannot be empty in /home/quickstart/websites/system1.dev/sites/all/modules/deploy/modules/filefield_deploy/filefield_deploy.module on line 18.
* warning: fread(): supplied argument is not a valid stream resource in /home/quickstart/websites/system1.dev/sites/all/modules/deploy/modules/filefield_deploy/filefield_deploy.module on line 20.

Module Description Result Message
Module Description Result Message
filefield File: image1.gif Error Could not create destination directory for file.

but it was because the file that the imagefield was referring to did not exist anymore.
"Could not create destination directory for file" was in fact caused by the fact that te source file wasn't there in the first place, and so could not be copied and created on the destination site.

#5

+1

#6

I can't seem to replicate this at all no matter how hard I try, can you let me know what versions of everything you're running?

#7

heyrocker:

thank you very much for your module, it has helped me a lot now. i had same problems with filefield. First problemerror appeared, because source "files" folder had different url than "destination" file foulder, it had to be same.

Second error was, when i had blank filefield field - only help was to turn off filefield deployment module for these nodes, patch by devinfoley did not help me.

#8

Status:patch (to be ported)» active

I can't reproduce this either. I have used filefields (and also empty ones) in several tests. Are you sure all your file permissions is correctly set up?

#9

I experienced this problem.

While trying to Deploy content to my staging server, I had added a Node for a content type that I was not ready to move over to Staging. I use Features on my websites, and so I hadnt enabled this feature on the Staging site yet. The Queue/Deployment Plan however had this node, and therefore was trying to send it and link it to a node that type wouldn't exist on the other end. This gave me the 'Could not create destination directory for file.' Error.

I have however NOT tried this yet with a Content type that does have a filefield. I will try that next, now that I have achieved a successful Deployment of my current nodes.

#10

Status:active» closed (cannot reproduce)

We need more information on this one.

Regarding #9, your error clearly states "Could not create destination directory for file.", which is caused by a permission problem in your files directories. Please check that.

#11

Status:closed (cannot reproduce)» postponed (maintainer needs more info)

#12

To help version 6.x-1.x move forward, please see this issue: #526936: Find best way to proceeding with 6.x-1.x and more specifically this comment: http://drupal.org/node/526936#comment-4931548