I am getting error while uploading from any pages. Folders are exists, file permissions are set to 755 but still getting error.

Code
if(isset($_POST['upload_attachemt']))
{
    $path = "uploaded_attachments/"; // Upload directory
    if($_FILES['attachment_file']['name']!='')
    {
        $attachment_file = md5(uniqid(rand(), true)).'.'.file_ext($_FILES['attachment_file']['name']);
        move_uploaded_file($_FILES["attachment_file"]["tmp_name"], $path.$attachment_file);
    }
    if(mysql_query("insert into tbl_attachment set attachment_name='".$_POST['attachment_name']."', attachment_userid=".$_REQUEST['user_id'].", attachment_file = '".$attachment_file."', attachment_date = '".date('Y-m-d H:i:s')."' "))
        header("Location:".$_SERVER['PHP_SELF']."?msg=Uploaded Successfully !!&user_id=".$_REQUEST['user_id']."&action=".$_REQUEST['action']);
}   
Design
if($_REQUEST['action']=='attachment')
{
   ?>
    <style>label{ font-weight:bold;}</style>
    <fieldset style="font:normal 12px Verdana; margin-top:20px;">
        <form method="post">
        <table style="font:normal 12px Verdana; width:100%" cellpadding="0" cellspacing="0">
        <tr>
            <td width="25%" style="background-color:#999999; font-weight:bold;padding:2px;">Attachment Name</td>
            <td width="50%" style="background-color:#999999; font-weight:bold;padding:2px;">View Attachment</td>
            <td width="25%" style="background-color:#999999; font-weight:bold;padding:2px;">Attachment Date</td>
        </tr>
        <?php
        $userdetail=mysql_query("select * from tbl_attachment where attachment_userid=".$_REQUEST['user_id']." order by attachment_date desc");
        while($row=mysql_fetch_array($userdetail))
        {
        ?>      
            <tr>
                <td style="padding:2px; border:1px #999999 dotted">
                <input type="checkbox" name="attachments[]" value="<?php echo $row['attachment_id']; ?>"  />
                <?php echo $row['attachment_name']; ?></td>
                <td style="padding:2px; border:1px #999999 dotted"><a href="uploaded_attachments/<?php echo $row['attachment_file']; ?>"><?php echo $row['attachment_file']; ?></a></td>
                <td style="padding:2px; vertical-align:top; border:1px #999999 dotted"><?php echo date('d-M, Y h:i:s A', strtotime($row['attachment_date'])); ?></td>

            </tr>
        <?php
        }
        ?>  
        <tr>
            <td width="25%" style="background-color:#999999; font-weight:bold;padding:2px;"></td>
            <td width="50%" style="background-color:#999999; font-weight:bold;padding:2px;"></td>
            <td width="25%" style="background-color:#999999; font-weight:bold;padding:2px; text-align:right">
            <input type="submit" name="delete_attachments" value="Delete"  />
            </td>
        </tr>
        </table>
        </form>
    </fieldset>

        <fieldset style="font:normal 12px Verdana; margin-top:20px;">
        <form method="post" enctype="multipart/form-data">
        <table style="font:normal 12px Verdana; width:100%" cellpadding="0" cellspacing="0">
        <tr>
            <td width="31%" style="background-color:#999999; font-weight:bold;padding:3px 5px;">Upload Attachment</td>
        </tr>
        <tr>

            <td width="31%" style="background-color:#999999; font-weight:bold;padding:2px;">
            <input type="text" name="attachment_name" id="attachment_name" required style="width:100%;" placeholder="Attachment Name ..." />
            </td>
        </tr>

        <tr>
            <td width="31%" style="background-color:#999999; font-weight:bold;padding:2px;">
            <input type="file" name="attachment_file" id="attachment_file" required style="width:100%;" placeholder="Attachment Name ..." />
            </td>
        </tr>        
        </table>
        <input  type="submit" name="upload_attachemt" value="Upload" id="upload_attachemt" style="margin-top:5px; float:right;"  />
        </form>

    </fieldset>
    <?php
}       

559610f21653f7ef4de8a81db9b1168d

This post has no text-based content.

It already set permission to 777

Are you sure the permission are on the correct folder? Most of the time the error messages are correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.