Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 18th, 2008, 10:56 PM
Authorized User
 
Join Date: Oct 2007
Location: Lucknow, UP, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7: permission Denied while uploading files

Problem

move_uploaded_file(C:/wamp/www/vab/userpics) ::failed to open stream: Permission denied in C:\wamp\www\vab\app_code\Controller\uploads.php on line 11



I am using WAMP package 2.0 on windows Platform.
can Any one Suggest what should be the solution for this Problem?

Here are Few steps that I followed........
1. I uncheck the "use simple file sharing " checkbox under tools>>Folder options >> views.

2. then I gave full controll to my useraccount on my application located at C:\wamp\www\vab


Here is code that I written.......
Code:
if(move_uploaded_file($_FILES['file']['tmp_name'],$imgname))
        {
            $type=checkFile($imgname); //to check file type
            if($type==".gif" ||$type==".jpg" || $type==".png"){
                $user=new UserInfo();
                $user->setEmail($_SESSION['email']);

                $done=$photo->changePhoto($imgname, $user, $type, $dir); // to create & save url in database.

                    if($done){
                        $_SESSION['msg']="Profile Picture Changed....";
                        redirect_to("../../pages/freeHome.php");
                    }
                    else{
                            $_SESSION['msg']="An error Occured while uploading.<br> Please try later....";
                            redirect_to("../../pages/freeHome.php");
                        }
                }
                else             
                    echo "Please Choose a correct File type";                    
            }


Please help me in resolving this code.

  #2 (permalink)  
Old July 28th, 2008, 06:54 PM
Registered User
 
Join Date: Jul 2008
Location: Leeds, , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is the value of you $imgname property "C:/wamp/www/vab/userpics"?

If so, I think you have only put in the directory name without the filename - hence, it won't work!

Here is the code I use: -

// for main server $imagedir = "/home/thechari/public_html/images/photos/";
$imagedir = "c:/xampp/htdocs/tcbr/images/photos/";

$imagetempname = $_FILES['filename']['name'][$i];

if ($imagetempname != "")
{
    $imagename = $imagedir . $imagetempname;
    if (move_uploaded_file($_FILES['filename']['tmp_name'], $imagename))

etc...

Let me know if it works!

  #3 (permalink)  
Old July 28th, 2008, 06:55 PM
Registered User
 
Join Date: Jul 2008
Location: Leeds, , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

whoops, made a mistake: -

$imagetempname = $_FILES['filename']['name'];




Similar Threads
Thread Thread Starter Forum Replies Last Post
(0x800A0046) Permission denied,not IIS permission! David Hay Classic ASP Basics 3 April 30th, 2006 10:47 PM
Permission denied zah_amir Classic ASP Databases 1 January 24th, 2006 11:45 PM
Permission denied tksarun Classic ASP Components 0 March 11th, 2005 03:01 AM
Permission Denied hamidmq Javascript How-To 2 March 10th, 2005 09:41 AM
Permission denied in acessing dll files sobhamuktha VB Components 6 February 4th, 2005 08:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.