Solved

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

Posted on 2008-06-12
15
196 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

895 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