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

Deciphered - July 23, 2008 - 23:44

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

upupax - July 24, 2008 - 12:49

Same for me..

#3

william_frane - July 24, 2008 - 16:29
Title:FileField won't allow upload» FileField won't allow upload - gives warning: preg_match() expects parameter 2 to be string ...

(Just changing the title to be more descriptive, since I noticed that someone else made a duplicate thread regarding this error.)

#4

Stoke - July 24, 2008 - 18:56

Same here.

It seems that v3.x does not work at all :/

#5

Deciphered - July 24, 2008 - 21:42

@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

mistresskim - July 24, 2008 - 21:57

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

Deciphered - July 25, 2008 - 02:38

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

dopry - July 31, 2008 - 04:40
Status:active» closed

this should be fixed in HEAD.

#9

hecatomber - August 10, 2008 - 17:34

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.

AttachmentSize
sikirinsat15.png177.32 KB

#10

wuf31 - September 4, 2008 - 15:26
Status:closed» active

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

drewish - October 10, 2008 - 16:18
Status:active» closed

on the issue wuf31 referenced he'd indicated the problem was custom code.

 
 

Drupal is a registered trademark of Dries Buytaert.