filefield.inc on line 87

$objects[] = $node->nid

if using multi-upload for filefield,the $bojects will be

array(1,1,1,1,2,3)

means that $node->nid = 1 has a 4 files attached in 1 filefield ,and this will be batch processed 4 times,actually the first process has done everyting ok for nid 1,so the last 3 processes will call a file_move error.
the fix,is simple: if(!in_array($node->nid,$objects)) $objects[] = $node->nid;
hope this could be fixed soon;

Comments

deciphered’s picture

Hi techlive,

Can you please clarify multi-upload for filefield? Are you referring to having multiple filefield's via CCK settings, or is 'multi-upload' a seperate module?

Let me know.

Cheers,
Deciphered.

weynhamz’s picture

sorry,via cck settings.

deciphered’s picture

Hmm, curious.

I have unlimited files set on most of my production sites using FileField Paths and I've never had any issues.
Can you provide some more information, such as the versions of the modules you are using and a simple step-by-step guide to reproduce the issues? Settings and error messages would be appreciated too.

Hope I can help.

Cheers,
Deciphered.

weynhamz’s picture

May be it's my mistake,i am developing a new module work with the filefield,need to update the filepath using the filefieldpaths module,so i use the function filefield_paths_batch_update($fieldname,'filefield', $node_type); to do this.Let me do more tests and find what's wrong.My module is developing,there have been many bugs,maybe caused be them.I will contact you later.

weynhamz’s picture

Otherwise,Is there any api can be used to get a filefieldpaths defined token replaced file path?

deciphered’s picture

Priority: Critical » Normal

Ok, looked at the information you provided properly and you are intact correct, there is definitely an issue, not critical, but still an issue and it will be fixed in the next version which should be out shortly.

Thanks for pointing it out :)

Cheers,
Deciphered.

deciphered’s picture

Simple fix for you until I commit the code.

In the filefield_paths_batch_update function, wrap the $objects (inside $batch) with array_unique().

Another thing, the code I will be committing actually changes that function a little, which means you'll have to change your code accordingly. It's only a minor thing, the variables have slightly changed, but the way it was written previously was a little crazy.

Cheers,
Deciphered.

deciphered’s picture

Status: Active » Fixed

Fix committed to DRUPAL-6--1.

Cheers,
Deciphered.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.