Page 1 of 1

File location

PostPosted: 28. October 2010 11:00
by Gernicha
Hello everyone,
I'm new to XAMPP and I would like to know where to put all my html/php files.

Is there a www directory?

Also, I would like to know how to get my html onto the localhost. E.G Click this then do that etc.

Thank you in advance,

Gernicha

Re: File location

PostPosted: 28. October 2010 21:37
by Gernicha
Yes, I know.

But thanks anyway! I just want tp know the steps...

Thanks!

Re: File location

PostPosted: 28. October 2010 22:15
by Gernicha
My PHP files aren't working,
When I try to use them, it either just shows the source code or tries to download it...

Your help would be greatly appreciated!

Thank you,

Gernicha

Re: File location

PostPosted: 28. October 2010 23:16
by JonB
Are you staarting the pages in your browser by opening them as in http://localhost/myphppage.php ??

Does the http://localhost/xampp/index.php page work?

Are you using php's short_open_tags? <? instead of <?php

if so, you will need to fix that in your php.ini

http://php.net/manual/en/ini.core.php

Re: File location

PostPosted: 28. October 2010 23:49
by Gernicha
Well, it's not really a index page, I'm using it as a file uploader. But, when it is ment to redirect to the php file it just displays source...

Thank you for all of your help!

Re: File location

PostPosted: 29. October 2010 02:29
by Gernicha
Here's the code (I didn't write it):

HTML (upload.html):

<html>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>


PHP (uploader.php):

<?php
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>

Re: File location

PostPosted: 29. October 2010 18:21
by Altrea
I will repeat the question:

Do you open the html/php file with the http: protocol?
more clearly: what does the browser address bar tell you, if you open and/or send the html form page?

Re: File location

PostPosted: 30. October 2010 07:10
by Gernicha
Sorry, fixed the problem!!
Thank you all SOOOO much!