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

DOM and Uploadify image not attaching


Go to End


25 Posts   12444 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 March 2011 at 4:08pm

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.

Avatar
squared99

Community Member, 12 Posts

30 September 2011 at 3:02pm

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.

Avatar
aarono

Community Member, 34 Posts

3 October 2011 at 11:34am

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

Avatar
BuddhaSource

Community Member, 57 Posts

28 February 2012 at 9:10pm

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.

Avatar
mirkosassetti

Community Member, 20 Posts

15 March 2012 at 10:54pm

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.

Avatar
mirkosassetti

Community Member, 20 Posts

16 March 2012 at 3:18am

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.

Avatar
mirkosassetti

Community Member, 20 Posts

16 March 2012 at 4:49am

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.

Avatar
squared99

Community Member, 12 Posts

19 March 2012 at 9:40am

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.