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
Solved

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

Posted on 2008-06-12
15
210 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Back Up Your Microsoft Windows Server®

Back up 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
two ways encryption with php 3 37
PHP not parsing ' character 12 46
parse url to form? 7 25
Row insertion failed. Array 5 46
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…
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…
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.

839 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