FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Installation Issues » post attachments don't work
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: post attachments don't work [message #32362 is a reply to message #32347] Thu, 22 June 2006 06:47 Go to previous messageGo to previous message
newnumbertwo is currently offline  newnumbertwo   United States
Messages: 38
Registered: June 2004
Karma:
Member
Quote:


If you want to write to a file, do something like this:



This has been working. Thanks for the pointer. I'm using this code in various places, mostly to see where I'm at in the program execution.

Quote:


attach.inc.t is a "source" file, the file that actually runs is a the compiled file "attach.inc", so after editing attach.inc.t you need to go into the theme editor and rebuild the theme.



Right -- I've been doing this.

Quote:


From the last run we know files are being uploaded, but the forum cannot seem to download them?



Sort of. I can definitely see the files after they're uploaded to the server, but after hitting the "upload file" button, they're not showing up in the post.

What looks like is happening is, the attachment isn't being written to the fud26_attach table. From using debugging statements, and trying to follow the code the best I can, I can see that we get all the way to the attach_add function, which I think is supposed to do the insertion.

The function gets the variables passed in correctly. $at comes in looking like this:

array (
'name' => 'readme.txt',
'type' => 'text/plain',
'tmp_name' => '/tmp/phpnmAY5m',
'error' => 0,
'size' => 177,
)

$owner is getting set to the proper UID, but when the actual insertion statement runs:
        $id = db_qid("INSERT INTO {SQL_TABLE_PREFIX}attach (location,message_id,original_name,owner,attach_opt,mime_type,fsize) SEL\
ECT '', 0, "._esc($at['name']).", ".$owner.", ".$attach_opt.", id, ".$at['size']." FROM {SQL_TABLE_PREFIX}mime WHERE fl_ext IN('', \
"._esc(substr(strrchr($at['name'], '.'), 1)).") ORDER BY fl_ext DESC LIMIT 1");

$id is always returned as '0'.

I'm not sure if this makes a difference or not, but there's nothing in the fud26_mime table. Could this be what's causing a value of 0 to be returned for the ID when I try to do a file upload?

Also, I looked at the mime_type column in the fud26_attach table for the attachments that did make it (long ago), and they all have a value of 0. However, these old attachments show up fine in the old posts.

Any idea what's happening here? I think I'm pretty close to figuring this out...

P.S. Here's the SQL statement that's being executed:
INSERT INTO fud26_attach (location,message_id,original_name,owner,attach_opt,mime_type,fsize) SELECT '', 0, 'readme.txt', 2543, 0, id, 177 FROM fud26_mime WHERE fl_ext IN('', 'txt') ORDER BY fl_ext DESC LIMIT 1

Which, when executed from the mysql shell, doesn't insert a row either. I'm not quite sure I understand the SQL that's being executed here either, or where the "location" is coming from (I know what it's supposed to be, I just can't figure out how it's being determined in this context).

[Updated on: Thu, 22 June 2006 06:58]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Trouble with TestFORUM in new eGroupware install
Next Topic: Error message
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 02:02:14 GMT 2024

Total time taken to generate the page: 0.03971 seconds