Jump to content


Photo

image upload


  • Please log in to reply
4 replies to this topic

#1 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 30 March 2006 - 06:52 PM

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:
<?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;
        }

EDIT BY OBER: PLEASE USE CODE TAGS TO POST CODE

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 30 March 2006 - 07:03 PM

You need to CHMOD the upload directory to 777.

Info: PHP Manual


#3 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 31 March 2006 - 01:07 AM

[!--quoteo(post=360106:date=Mar 30 2006, 07:03 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 30 2006, 07:03 AM) View Post[/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?

#4 High_-_Tek

High_-_Tek
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 31 March 2006 - 02:24 AM

Go into whatever FTP client you use and chmod the folder where your uploads are going to: 777

#5 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 31 March 2006 - 02:58 AM

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...


all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users