FileField won't allow upload - gives warning: preg_match() expects parameter 2 to be string ...
william_frane - July 23, 2008 - 19:25
| Project: | FileField |
| Version: | 6.x-3.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
Hello,
When a user tries to create a content type that has FileField CCK field, the following error is generated:
warning: preg_match() expects parameter 2 to be string, array given in /usr/webserver/content/drupal/docs/includes/bootstrap.inc on line 723.The node creation page still displays, but if the user tries to upload a file the following errors are generated:
The selected file sample_file.txt could not be uploaded. Only files with the following extensions are allowed: .
warning: preg_match() expects parameter 2 to be string, array given in /usr/webserver/content/drupal/docs/includes/bootstrap.inc on line 723.It also appears that the node is trying to be saved at the same time. The first error also seems incorrect, as when adding the file upload field to this particular content type, I left the "allowed extensions" field blank, so all extensions should be allowed.
Previously, I was using version 6.x-1.0-beta2 of FileField, and none of these errors occured.
Any assistance would be greatly appreciated. Thanks!

#1
I can confirm this.
If you define file types allowed to be uploaded it will eliminate the second error, but it's still the wrong behavior.
#2
Same for me..
#3
(Just changing the title to be more descriptive, since I noticed that someone else made a duplicate thread regarding this error.)
#4
Same here.
It seems that v3.x does not work at all :/
#5
@Stoke - I beg to differ, it has some issues, but it's far from not working at all. As I mentioned, you can still upload, you just have to define allowed extensions first.
#6
Declaring the allowable extensions still results in the bootstrap error, which is obviously not a good thing. I think I will go back to 6.1 in the meantime, if that's possible.
#7
I believe the bootstrap error was fixed in the last nightly build, I'm not entirely positive as I wasn't looking for it until a fair while after I updated.
As for the extensions issue, I submitted a patch that fixes the issue: #286972: Fix $extensions validation to enable any file if extensions left blank
#8
this should be fixed in HEAD.
#9
I'm still having this problem, when I try to upload an image (using imagefield) the edit page refreshes, all the other fields remove their content, and I can see the image preview on that page.
Here is a screenshot in the attachment.
#10
I'm not sure if this has anything to do with imagefield or filefield, but i'm also experiencing this.
Take a look at #285391: Recoverable fatal error in bootstrap.inc.
I post a debug_backtrace there.
Thanks for any help
#11
on the issue wuf31 referenced he'd indicated the problem was custom code.