Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
upload.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2007 at 11:27 UTC
Updated:
1 Sep 2007 at 11:50 UTC
Enable upload.module.
Go and create a Page content. Open "File attachments" fieldset and select a file.
Hit "Attach": the file will be correctly uploaded (you can see it in the files/ directory) and correctly showed in-place in "File attachments" section.
Now hit "Save". No file is listed as attachment for the new node. Even if you go to edit the node, no attachment is shown.
Now follow the same workflow, but instead of saving directly hit "Preview", wait preview to load and then "Save". The file will be correctly attached.
Same behaviour has been recorded with download method set to public or private.
Also still same behaviour if you don't hit "Attach" after selecting the file.
Comments
Comment #1
flevour commentedIn #drupal chx suggests mentioning #160039 won't fix the issue.
Comment #2
flevour commentedLink to bug #160039.
Comment #3
flevour commentedI have found a weird behaviour. I activated the devel module and set it to show redirects.
I also modified upload_save in upload.module to dpr($node) when it's called.
I then proceed as I noted in the report:
- go to create a page
- select an attachment and do not press "Attach"
- press Save
The page informing about the redirect shows the dpr($node) with an empty $node->files.
I then refresh. To my surprise dpr($node) shows $node->files with correct file informations.
Maybe it's something magic involved with FAPI or something like that.
Comment #4
flevour commentedCommenting form_set_cache call in drupal_get_form() temporarily fixes the issue. This means attaching a file and saving directly now works. I am discussing this issue chx to tackle in IRC right now.
As per chx suggestion, I am working with HEAD + patch #160039.
Comment #5
flevour commentedI found out the problem is about caching. Setting $form['#cache'] = FALSE; infact fixes the problem.
As eaton, pwolanin and frando tell me, use of #cache is considered a bug in core, so I am not even bothering to submit a patch.
Just in case you need a quick fix, add "$form['#cache'] = FALSE;" at line 220 in upload.module
Comment #6
flevour commentedChaning title to a more descriptive one.
Preview+save/update still works.
Comment #7
chx commentedDespite this issue is senior I patched http://drupal.org/node/168813 so I close this one.