tecdesign Posted March 30, 2006 Share Posted March 30, 2006 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 13Warning: 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 13The coding for adding the image is:[code]<?phpfunction 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 https://forums.phpfreaks.com/topic/6201-image-upload/ Share on other sites More sharing options...
ober Posted March 30, 2006 Share Posted March 30, 2006 You need to CHMOD the upload directory to 777. Link to comment https://forums.phpfreaks.com/topic/6201-image-upload/#findComment-22385 Share on other sites More sharing options...
tecdesign Posted March 31, 2006 Author Share Posted March 31, 2006 [!--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 https://forums.phpfreaks.com/topic/6201-image-upload/#findComment-22496 Share on other sites More sharing options...
High_-_Tek Posted March 31, 2006 Share Posted March 31, 2006 Go into whatever FTP client you use and chmod the folder where your uploads are going to: 777 Link to comment https://forums.phpfreaks.com/topic/6201-image-upload/#findComment-22512 Share on other sites More sharing options...
litebearer Posted March 31, 2006 Share Posted March 31, 2006 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 https://forums.phpfreaks.com/topic/6201-image-upload/#findComment-22523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.