Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Uploadify HTTP Error


Go to End


80 Posts   37910 Views

Avatar
gieser

Community Member, 13 Posts

29 August 2011 at 4:32am

I have looked further into the issue now. It seems those bytes are appended to the refresh-Link URL which is called by the Uploadify SWF when the upload has finished.

http://localhost/ss245_new/admin/EditForm/field/GalleryItems/UploadifyForm/field/UploadedFiles/refresh?SecurityID=56790d566e0a5692041b48af59f6f745c175090d&ctf[GalleryItems][start]=0&ctf[GalleryItems][per_page]=10&ctf[GalleryItems][showall]=0&ctf[GalleryItems][sort]=SortOrder&ctf[GalleryItems][sort_dir]=&ctf[GalleryItems][search]=&ctf[GalleryItems][filter]=AlbumID_4&ctf[GalleryItems][view]=grid&ctf[GalleryItems][imagesize]=100&FileIDs=%EF%BB%BF320

You can see the FileIDs field has those strange hex-codes before the id of the uploaded image, which would be 320 in this case. I'm currently trying to figure out where these come from.

Avatar
Tama

Community Member, 138 Posts

16 November 2011 at 4:34pm

We're having a similar issue as gieser with hex-coded characters getting appended before the FileIDs. In our case it's a combination of line breaks and two tabs: "\r\n\r\n\r\n "

http://localhost/admin/EditForm/field/PageImages/AddForm/field/PageImage/refresh?SecurityID=b0bc976db7c59160de5b3c95c551a1be363df3d8&FileIDs=%0D%0A%0D%0A%0D%0A%09%09101

This looks like contamination from the source code but it's hard to know where we should be looking.

Avatar
Sticks

Community Member, 31 Posts

2 December 2011 at 6:12pm

I'm getting the same problem as above. The selected files/images are uploading fine but are not being attached. A 500 error is being thrown with the ID being returned with extra characters.

ERROR [User Warning]: DataObject::get_by_id passed a non-numeric ID #\r\n264
IN GET /mysite/admin/EditForm/field/Photo/refresh?FileIDs=%0D%0A264
Line 2924 in C:\wamp\www\mysite\sapphire\core\model\DataObject.php

Avatar
Lukin

Community Member, 56 Posts

15 February 2012 at 10:37pm

is there any solution for that extr-character issue in front of the fileID?

Avatar
Lukin

Community Member, 56 Posts

15 February 2012 at 11:20pm

-> HACK

in FileUploadField or MultipleFileUploadField we have a function called File,...

MultipleFileUploadField Line 161 we have a DataObject::get to get the list of attached files

-> if($files = DataObject::get($class, "\"{$class}\".\"ID\" IN (".Convert::raw2sql($list).")")) {

I changed it into

if($files = DataObject::get($class, "\"{$class}\".\"ID\" IN (".Convert::raw2sql(preg_replace('![^,0-9]!', '', $list)).")")) {

the regular expression removes all characters except of numbers and commas (which separates the ids)

I tried to write a decorator to override the File-Function but without luck,... maybe anybody can tell me how to do this?
Where to put the decorator-file?
In which conifg-file do I have to register the decorator?

cheers

Avatar
Neuman

Community Member, 2 Posts

13 April 2012 at 9:52am

I had this same HTTP error when trying to upload a PDF file using Uploadify with FileUploadField, although it worked fine with ImageUploadField.
I decided to go back to the old FileIFrameField upload method. This gave me the error: "[User Error] Bad RecordClassName '' and $baseClass not set". I looked in the File table and found several records with empty ClassName fields. When I fixed this issue FileIFrameField started working, as did FileUploadField.

Avatar
jak

Community Member, 46 Posts

27 April 2012 at 3:24am

I just stumbled across the same problem as gieser. %EF%BB%BF is the Unicode byte order mark. This means that some file is saved as UTF8. To fix the error find the file (it is most probably some file you wrote yourself!) and save as UTF8 without byte order mark. Most editors should be capable of doing this. In Notepad++ it is done by choosing Encoding->Encode in UTF-8 without BOM.

sticks had/has %0D%0A, which is windows style newline (CR LF ). Look for a newline in front of <?php

HTH
Jak

Avatar
Scott Farmer

Community Member, 49 Posts

3 May 2012 at 11:33am

Hi,

Uploadify HTTP errors:
I was banging my head against the wall on this one! It turns out it was a rather simple solution.

Make sure the function name is the same name used in the form. The controller action.
i.e.

function ImageUploadStepForm() {

$fields = new FieldSet(
new FileUploadField('UserPhoto2', 'Upload Image')
);

.
.
.

$form = new Form($this, 'ImageUploadStepForm' (!!!Has to be the same!!!), $fields, $actions);

Hope that helps other people with this issue.

Regards
Scott