Solved

how do i give a dirictory in windows vista to write and read?

Posted on 2008-06-12
15
214 Views
Last Modified: 2009-07-29
how do i give a dirictory in windows vista to write and read?

so i can upload files to it?
0
Comment
Question by:mgtm3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
15 Comments
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21771373
Are you using IIS or Apache?

If IIS, you need to grant write permissions to the IUSR account (as that is the account which IIS will use to access the folder).
0
 

Author Comment

by:mgtm3
ID: 21771386
i dont know
i am using wamp

mysql
php

how do i know?
0
 

Author Comment

by:mgtm3
ID: 21771392
i am using Apache,
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Assisted Solution

by:brad2575
brad2575 earned 150 total points
ID: 21771396
Not sure for vista but should be similar to XP you can do this:

Go to the folder in Windows Explorer
Right click on the folder go to Properties
Go to Security
Select the IIS user (if not in list have to "Add" them)
Then give them the permissions you want them to have (read/write).


0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21771521
In Apache on Windows, so long as the folder is within your web root folder, the default is that it is writable by PHP.
0
 

Author Comment

by:mgtm3
ID: 21771574
its not working i dont know why
i am tring to upoload i a file using php its not working
0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21771724
What is the error you are receiving?
0
 

Author Comment

by:mgtm3
ID: 21771751
no error its just nothing
0
 
LVL 24

Accepted Solution

by:
purplepomegranite earned 350 total points
ID: 21771824
Then there is an error.  Try adding the attached code to the start of the PHP page.  It should force PHP to display any errors.
<?php
ini_set('display_errors', 1); 
error_reporting(E_ALL);
?>

Open in new window

0
 

Author Comment

by:mgtm3
ID: 21772037
i add it
i got no error
0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21772129
But you are just getting a blank page?  Should there be any output from your page (i.e. text)?  A blank page more often than not implies a syntax error in the code.  It may be worth posting the code here so that it can be double-checked.
0
 

Author Comment

by:mgtm3
ID: 21772240
this is the html code

<html>
<body>
  <form enctype="multipart/form-data" action="filephp.php" method="post">
    <input type="hidden" name="MAX_FILE_SIZE" value="20000" />
    Choose a file to upload: <input name="ufile" type="file" />
    <input type="submit" value="Upload" />
  </form>
</body>
</html>


and this is the php code that when i click sumbet it goes to here
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>



<?php





$ufile=$_FILES['ufile'];
$name=$ufile['name'];
$type = strrchr("$name",".");
$type = substr($type, 1);


$tmplocation=$ufile['tmp_name'];
$size=$ufile['size']/1000;
$error=$ufile['error'];

if ($name=="")
echo "You need to choose a photo to upload";
else
{
echo $type;
if(($type!="jpg") && ($type!="jpeg") && ($type!="gif")&&($type!="bmp")&&($type!="png"))
{
echo "You can only upload a photo";
}
else
{
if($size>3)
echo 'the max size of the file is 3mb';
else
{

$newname = 'upload/'.$name;

   move_uploaded_file($_FILES['ufile']['tmp_name'], $newname);
   





}}}
0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21774244
The PHP had lots of errors in it.  Also, it helps to read it if you indent structures (such as if structures).

Attached is the code without syntax errors.  See if you get better results with it.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$ufile=$_FILES['ufile'];
$name=$ufile['name'];
$type = substr(strrchr($name,"."), 1);
 
$tmplocation=$ufile['tmp_name'];
$size=$ufile['size']/1024;
$error=$ufile['error'];
 
if ($name=="") {
	echo "You need to choose a photo to upload"; }
else {
	echo $type;
	if(($type!="jpg") && ($type!="jpeg") && ($type!="gif")&&($type!="bmp")&&($type!="png")) {
		echo "You can only upload a photo";}
	else {
		if($size>3) {
			echo 'the max size of the file is 3mb'; }
		else {
			$newname = 'upload/'.$name;
			move_uploaded_file($_FILES['ufile']['tmp_name'], $newname);
		}
	}
}
 

Open in new window

0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21774249
Oh, apart from the fact I missed out the closing ?>.  Added in this code.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$ufile=$_FILES['ufile'];
$name=$ufile['name'];
$type = substr(strrchr($name,"."), 1);
 
$tmplocation=$ufile['tmp_name'];
$size=$ufile['size']/1024;
$error=$ufile['error'];
 
if ($name=="") {
	echo "You need to choose a photo to upload"; }
else {
	echo $type;
	if(($type!="jpg") && ($type!="jpeg") && ($type!="gif")&&($type!="bmp")&&($type!="png")) {
		echo "You can only upload a photo";}
	else {
		if($size>3) {
			echo 'the max size of the file is 3mb'; }
		else {
			$newname = 'upload/'.$name;
			move_uploaded_file($_FILES['ufile']['tmp_name'], $newname);
		}
	}
}
?>

Open in new window

0
 

Author Comment

by:mgtm3
ID: 21774346
it dose not work


0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question