Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Uploadify HTTP Error

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10
Go to End
Author Topic: 22033 Views
  • gieser
    Avatar
    Community Member
    13 Posts

    Re: Uploadify HTTP Error Link to this post

    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.

  • Tama
    Avatar
    Community Member
    130 Posts

    Re: Uploadify HTTP Error Link to this post

    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.

  • Sticks
    Avatar
    Community Member
    29 Posts

    Re: Uploadify HTTP Error Link to this post

    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

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: Uploadify HTTP Error Link to this post

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

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: Uploadify HTTP Error Link to this post

    -> 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

  • Neuman
    Avatar
    Community Member
    2 Posts

    Re: Uploadify HTTP Error Link to this post

    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.

  • jak
    Avatar
    Community Member
    46 Posts

    Re: Uploadify HTTP Error Link to this post

    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

  • Scott Farmer
    Avatar
    Community Member
    35 Posts

    Re: Uploadify HTTP Error Link to this post

    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

    22033 Views
Page: 1 2 3 4 5 6 7 8 9 10
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.