Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DOM and Uploadify image not attaching

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4
Go to End
Author Topic: 4815 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    I'd have to look at it. If you want to contact me with your FTP info at unclecheese at leftandmain dot com, I can get you details about timing and cost for support.

  • squared99
    Avatar
    Community Member
    12 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Did this mystery ever get solved? I am having what sounds like a very similar issue.

    The files upload ok, but for some reason it just seems to fail quietly, basically aborts. Since nothing is echoed out the refresh call is never triggered, since no content is returned in the response.

    I've debugged my way through, and get as far as the Upload class call to call loadIntoFile.

    Inside the Upload class it will go as far as the load method and get to the $this->file->write() just before it is supposed to return true.

    So basically it looks like it fails on writing to the database.

    I have no idea why since file uploads from the WYSIWG work fine, uploaded and saved to DB and assume they would be calling the write method.
    There is no errors in the logs either.

    The Debug::show output of $this->file at the point show a new file record with fields filled in for file name, title, etc and an ID of 0, which you would expect just prior to a write call.

    Maybe it it is just aside effect of something else but Im very stumped.

  • aarono
    Avatar
    Community Member
    34 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Hi squared99

    I'm not sure if it is the same error. If I remember correctly, my problem was just a PHP memory issue that was causing the problem. Its been a while since, but I think I just ended up adding
    php_value memory_limit 128M
    to the .htaccess and all was good!

    Hope this helps
    Cheers

  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    I am having same problem

    1. Upload image but not attaching
    2. Image exists in Choose from existing and if I select it it attaches just fine.

  • mirkosassetti
    Avatar
    Community Member
    20 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Same problem here.
    I think is somehow server related because with the same version of silverstripe, DOM and Uploadify, i get it only on one website.
    I have analyzed the HTTP Response with Charles Proxy an i found this error:

    =========================
    HTTP/1.1 500 Error: "Couldn't run query: SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."ShowInSearch", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ID" IN (Ôªø632)) ORDER BY "SortOrder" ASC Unknown column 'Ôªø632' in 'where clause'" at line 525 of /var/www/sapphire/core/model/MySQLDatabase.php
    Date: Thu, 15 Mar 2012 09:34:06 GMT
    Server: Apache/2.2.14 (Ubuntu)
    X-Powered-By: PHP/5.3.2-1ubuntu4.14
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Set-Cookie: PastMember=1; expires=Wed, 13-Jun-2012 09:34:06 GMT; path=/; httponly
    Vary: Accept-Encoding
    Content-Encoding: gzip
    Content-Length: 1315
    Connection: close
    Content-Type: text/plain

    ERROR [User Error]: Couldn't run query:
    SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."ShowInSearch", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName"
    FROM "File"
    WHERE ("File"."ID" IN (632))
    ORDER BY "SortOrder" ASC

    Unknown column '632' in 'where clause'
    IN GET /admin/assets/EditForm/field/Files/UploadifyForm/field/UploadedFiles/refresh?SecurityID=1e3abe98b4d9888ff9a3c7cb8648bc5ffd7c93a2&ctf[Files][start]=0&ctf[Files][per_page]=10&ctf[Files][showall]=0&ctf[Files][sort]=SortOrder&ctf[Files][sort_dir]=&ctf[Files][search]=&ctf[Files][filter]=&ctf[Files][view]=&FileIDs=%EF%BB%BF632
    Line 525 in /var/www/sapphire/core/model/MySQLDatabase.php
    ...
    =========================

    Got the special chars in the query?
    It make mysql search for a column named Ôªø632.

    Now i try to deep debug that to find where these spacial chars is generated and why. I keep you updated.

  • mirkosassetti
    Avatar
    Community Member
    20 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Nothing for now.
    I try to debug the SQL query until the call of mysql_query in Database.php and it appear to be always clean.
    Searching Google for Ôªø make think is something related with encoding, but can't figure out where this problem can happen.

  • mirkosassetti
    Avatar
    Community Member
    20 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Finally found something.
    The "problem" is in the javascript uploadify_init.js, found by chance beacause with Google Chrome the alert below is fired:

    if(isNaN(response)) {
    alert(response);
    }

    response, wich should be the id of our new file, have some damn special chars before it.
    I can't figure out why these special chars are attached (problem with flash or the uploadify.js?), but for now i make it work by adding the following hack before the above if statement:

    response = escape(response).substring(6); // Hack

    Maybe can help someone, but hope i will, or someone, find why this happen.

  • squared99
    Avatar
    Community Member
    12 Posts

    Re: DOM and Uploadify image not attaching Link to this post

    Couple things I can add from own experiences:

    - make sure you have all the required php libraries installed. For example, GD for thumbnailing, etc.
    - check your permissions for the folder that the assets will end up in.
    - also as mirkosassetti pointed out, if you have any global debug, or echo coming out somewhere during the process it may break the returned ID value from the ajax call during the upload, meaning the files upload but the db relationship is broken or it bails directly after with an error.

    Hope some of those are helpful.

    4815 Views
Page: 1 2 3 4
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.