supanoob Posted February 28, 2007 Share Posted February 28, 2007 I am trying to get my upload script to work and i get this error when i run the script Warning: copy(/home/porky/public_html/01) [function.copy]: failed to open stream: Permission denied in /home/porky/public_html/account.php on line 340 Error any ideas on how to fix it? Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/ Share on other sites More sharing options...
boo_lolly Posted February 28, 2007 Share Posted February 28, 2007 are you running linux or windows? Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/#findComment-196302 Share on other sites More sharing options...
supanoob Posted February 28, 2007 Author Share Posted February 28, 2007 linux Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/#findComment-196303 Share on other sites More sharing options...
willpower Posted February 28, 2007 Share Posted February 28, 2007 sounds like a folder permissions issue. a) what are you trying to do on that line b)what chmod is your upload directory set to. the permissions will probably need to be set to 777 But bewarned this does present a significant security risk Will Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/#findComment-196307 Share on other sites More sharing options...
supanoob Posted February 28, 2007 Author Share Posted February 28, 2007 This is the code, i will bold the line that is says the error is on <?php if ($_GET['step'] == 'upload_new_complete') { // Your file name you are uploading $file_name = $HTTP_POST_FILES['ufile']['name']; // random 4 digit to add to our file name // some people use date and time in stead of random digit //combine random digit to you file name to create new file name //use dot (.) to combile these two variables $new_file_name=$images_had.$account_id; //set where you want to store files //in this example we keep file in folder upload //$new_file_name = new upload file name //for example upload file name cartoon.gif . $path will be upload/cartoon.gif $path= "/home/porky/public_html/".$new_file_name; if($ufile !=none) { [b]if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))[/b] { echo "Successful<BR/>"; //$new_file_name = new file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; echo "<a href=\"/profile/$new_file_name\">Click Here to View</a><br>"; echo "Image Thumbnail:<br> <img src=\"/profile/$new_file_name\" width=\"150\" height=\"150\">"; } else { echo "Error"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/#findComment-196313 Share on other sites More sharing options...
supanoob Posted February 28, 2007 Author Share Posted February 28, 2007 This has been solved it was my mistake i missed something out of the code. Link to comment https://forums.phpfreaks.com/topic/40569-solved-permission-denied/#findComment-196316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.