开发者

Permissions problems for upload through php

Through the imap_* functions of php i'm trying to store the attachments of the emai开发者_StackOverflow社区ls on my server. I want to store the contents ($c, string) of the file with filename($f) in a sub-directory named with a thread id ($thread). m_attpath is a defined constant pointing absolute to the base folder.

    if(!is_dir(m_attpath.$thread)){
         mkdir(m_attpath.$thread);
    };

$handle = fopen(m_attpath.$thread.'/'.$f, 'w+');
fwrite($handle, $c);
fclose($handle);

But now i'm struggeling with the permissions i need to set in order to let the attachements viewable through an download.php page.

the main folder m_attpath = 0777 the thread folder is 0644 the files them self are also 0644

When viewing the files through my browser they end up as an question mark. The browser doesn;t display an 404 warning. In an ftp programm i can see the size of the attachments. Something is wrong, but i cant find what. Can anyone help me with this?

thanx


if m_attpath is a constant this code is wrong.

Should be

$handle = fopen(m_attpath.$thread.'/'.$f, 'w+');

What do you mean with "they end up as a question mark"?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜