MyBB Community Forums

Full Version: attachments question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

this is my situation:

when I add attachment to post, it seems like everything is OK - only the attachment data is not written into database. The database record is created, but filedata and thumbnail columns stay empty ([BLOB - 0 bytes]).

I searched code and did some tests:

in function checkattachment() I checked if $attachment[whatever] is OK and it seemed it was. The file seemed to be uploaded and all its attributes was available (I mean size, tmp_name etc.) The problem came with calling fopen($attachment[tmp_name], "r"); - it returns false.

safe mode is off. (I dont know if its relevant but ...)

Any ideas?
Is your server configured correctly to handle file uploads? I'm not sure if there's an option or something.
in phpinfo() one statement is

file_uploads: ON

is it what you meaned? (sorry for my english)

But another statement is:

upload_tmp_dir: no value
user_dir: no value
I just listen to the Peter Gabriel's song:
(It goes like this)
"Please, talk to me..."

Toungue

Nobody really can help? No idea?
It sounds server related, you should ask them if they allow uploads. I know a few host that disable it.
yeah, thanks for help!

I contacted my hoster and this is my attempt of translation of what I got from them:

Quote:Because of aplicated restriction is not possible to get uploaded file from temp dir by copy() or fopen() functions. You can get the file only using move_uploaded_file()

So, am I right thinking I have to modify the function checkattachment() this way:
replace the line: $att = fopen($attachment[tmp_name], "r");
with:
move_uploaded_file($attachment[tmp_name],"./tempFiles/file");
$att = fopen("./tempFiles/file", "r");

thanks for comments
I did it, it seems to work OK now.