Jump to content

image upload


tecdesign

Recommended Posts

The error message on the page is:

Warning: move_uploaded_file(investment_pic/303966750illustrations.htm): failed to open stream: Permission denied in /var/users/wealth/wealthcreate.com/htdocs/inc/typeinvest.php on line 13

Warning: move_uploaded_file(): Unable to move '/tmp/php2K3d1Y' to 'investment_pic/303966750illustrations.htm' in /var/users/wealth/wealthcreate.com/htdocs/inc/typeinvest.php on line 13

The coding for adding the image is:
[code]
<?php
function  updatedb($input,$my_username){
    extract($input);
    $photo=$_FILES['photo']['name'];
    $uploaddir = 'investment_pic/';
    if (!$address_1) $submit_error.="<br />- Address field need to be filled.";
    if (mysql_num_rows(mysql_query("select * from investment_tbl where address_1='$address_1'"))) $submit_error.="<br />- Investment deal already exists.";
    if ($_FILES['photo']['size']>100000){
        $submit_error.="<br />- Your photo size execced limit 100kb";
    }
    else {
        $fileName=$uploaddir.rand().$photo;
        if (move_uploaded_file($_FILES['photo']['tmp_name'], $fileName)){
        $submit_suc .= "<br />-Photo uploaded";
        chmod($fileName,777);
        }
        else
        $submit_error .= "<br />-File upload error";
    }
    
    if (!$address_1 || !$invest_type )    $submit_error .= "<br />- You must fill out all of the required forms.";
    if (!$submit_error) {
        $getaccount = mysql_query("
        SELECT      id,
                    email,
                    staff_rank
        FROM        accounts
        WHERE       username='$my_username'
        ");
        $photo=$fileName;
        $this_account=mysql_fetch_object($getaccount);
        $settle_date=time();
        $contructor_id=$this_account->id;
        if ($this_account->staff_rank==1){
            $confirm_date  =time();
        }
        else {
            $confirm_date=0;
        }
[/code]

[b]EDIT BY OBER: PLEASE USE CODE TAGS TO POST CODE[/b]
Link to comment
Share on other sites

[!--quoteo(post=360106:date=Mar 30 2006, 07:03 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 30 2006, 07:03 AM) [snapback]360106[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You need to CHMOD the upload directory to 777.
[/quote]

I am not quite following. Is this in the website hosting or in the coding. So I take it
chmod($fileName,777); is wrong it should be chmod(777);? Or do I have to change the upload directory to CHMOD to 777?
Link to comment
Share on other sites

Might also take a look here....

[a href=\"http://uk2.php.net/manual/en/function.chmod.php\" target=\"_blank\"]http://uk2.php.net/manual/en/function.chmod.php[/a]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
If you cannot chmod files/directories with PHP because of safe_mode restrictions, but you can use FTP to chmod them, simply use PHP's FTP-functions (eg. ftp_chmod or ftp_site) instead. Not as efficient, but works.[/quote]

Lite...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.