?
Solved

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

Posted on 2008-06-12
15
Medium Priority
?
226 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 16

Assisted Solution

by:brad2575
brad2575 earned 600 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 1400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

800 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