Solved

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

Posted on 2008-06-12
15
184 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
  • 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
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 …

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now