I would like to have simple upload w/ Apache on Windows. The intent is able to upload a file via HTTP protocol. I have Apache installed and running. What is the easiet way to set it up?
Name this index.php and place it in a folder named "file"
Next open a new text editor page and paste this:
<html>
<head>
<title>Results of Upload</title>
</head>
<body>
<h1>File Upload Results</h1>
<?php
$file_dir = "C:\location of your file folder (you need to change this....";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("Couldn't copy");
print "file was moved!<br><br>";
}
}
?>
</html>
Save this is as upload.php
***************************************
This should work - it works for me...Mind you - make sure to .htaccess your folder. Just an idea.
Stop Apache. net stop apache in command or stop apache using the start menu.
-First, open the configuration file(httpd) - located in the 'conf' folder of Apache
-Search for DirectoryIndex then we will add little extra characters to that line.
-Follow the image below. just add index.php and index.htm after index.html
Next --
Go to the line or search for 'AddType application/x-tar .tgz'
below that line add the following:
-You can cut and paste them.
Then unzip this file into the folder 'c:\php'
Note: When you unzip this file, it drops an extra folder.
C:\php\php-blah*. Move the contents of the second php folder to the first one then delete that extra php folder that was created.
Configure PHP
Go into folder 'c:\php' find file 'php.ini-dist' rename it to 'php.ini'
Open the file 'php.ini' using 'Notepad'
Under 'Search' click 'Find' or 'Edit' click 'Find' on Windows 2000 or press 'Ctrl+F'
then type this 'doc_root' - change to the directory of where your site is being held..mying is in c:\web example below:
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
doc_root = "c:\web"
Next change the extension_dir to the info below.
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:\php"
Moving along....
-Save and Close the file.
-Now, lets move this file to:
'php.ini' to c:\windows -- Win95/98/XP
To c:\winnt or c:\winnt40 -- WinNT/2000/XP
copy the file php4apache.dll from c:\php\sapi folder to the apache.exe folder
By default c:\Program Files\Apache Group\Apache
also copy the file php4ts.dll from c:\php to the same apache.exe folder
.....
Ok now for the test!
Open your fav text editor and paste this inside:
Today's date is: <? print (date ("M d, Y")); ?>
save it and call test.php
********
Load the test.php file to your web directory and turn your web server on...and you should be good to go!
I got it working for small files. I remove the hidden input MAX_FILE_SIZE or set it to sth like 10000000. However, any large file (e.g. 1MB) won't work. Is there some setting to control the upload file size?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.