When a filefield widget is left empty it will produce an error such as:

The selected file /var/www could not be copied.

Extra validation of the filefield is needed to prevent an empty field from being processed.

CommentFileSizeAuthor
#13 288416_11.patch558 bytesmsonnabaum
#11 288416_11.patch566 bytessammys
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered’s picture

Status: Active » Closed (fixed)

Fix committed

delapohl’s picture

I am experiencing this issue with v6.x-1.4.

pimousse98’s picture

Same here, but the field is not empty. It is happening while using swfupload, so it actually handles multiple files.

jbenjamin’s picture

Status: Active » Closed (fixed)

Experiencing the same issue using the filefield_paths-6.x-1.x-dev version. An empty field seems to cause the error, and no files are uploaded.

report shows "FileField Paths failed to move file () to (REG/.)." This is the one upload slot not used (there are three filefield cck fields in the content type.)

moved to active, since the new(er) post may not have been noticed.

jbenjamin’s picture

Status: Closed (fixed) » Active
kunago’s picture

Status: Closed (fixed) » Active

I have recently discovered the same error on my system - if I leave a filefield field empty, I get this error from Drupal. So far I have not been successful in fixing this issue.

kunago’s picture

Status: Active » Needs review

I came up with a workaround that fixes the issue for me. In 'filefield_paths.module', on the first line in the function 'filefield_paths_filefield_paths_process_file' replace this line

if ($new) {

with this one

if ($new && !empty($file['field']['filename'])) {
homoludens’s picture

This problem still exists (and is getting very old), and fix provided in #7 fixes it.

Deciphered’s picture

I am currently in the process of re-writing FileField Paths for a 2.x release, this issue will be resolved in that release.

Cheers,
Deciphered.

Deciphered’s picture

Issue tags: +FileField Paths 2.x

Tagging

sammys’s picture

FileSize
566 bytes

Here's a patch for those that need it. It applies to 6.x-1.4.

sgabe’s picture

I just encountered this error and the patch in #11 solved the problem.

msonnabaum’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
558 bytes

Patch looks good although it wouldn't apply for me because it had carriage returns.

Attached patch applies cleanly.

MXT’s picture

Subscribing.

dman’s picture

I'm getting this. Lost ages tracing it down to here (was deep in some huge imports where 20 other files were being moved around for other reasons, and I always blame my own recently-modified code first)
Yeah #13 looks like the answer

crea’s picture

Subs

parasolx’s picture

Status: Reviewed & tested by the community » Fixed

#13 fixed for me also. This solution already long time ago under this discussion but never commit into project.

I put this issue as fixed and hopefully it will commit in next release cause this is second time for me to do a manual fixing.

sgabe’s picture

Status: Fixed » Reviewed & tested by the community

The issue is fixed only when the solution is committed!

h0tw1r3’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed to 6.x-1.x branch.

roball’s picture

Version: 6.x-1.x-dev » 6.x-1.4

The fix is now officially available in version 6.x-1.5.