UPDATE:
Ok, I got the page to stop giving me errors by supplying the source file
path like this:
move_uploaded_file("d:\\temp\\" . $_FILES['userfile']['tmp_name'],
"d:\\");
But that still doesn't move the uploaded file to the d:\ either.
Any ideas?
--> -----Original Message-----
--> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
--> Sent: Monday, January 20, 2003 3:19 PM
--> To: 'Stephen Edmonds'
--> Cc: 'PHP Windows Helplist'
--> Subject: RE: [PHP-WIN] Moving an uploaded file keeps failing
-->
-->
--> Well, I made these changes, and it still is giving me
--> errors for some reason. Also, the drive IIS is on is FAT32,
--> so I don't think it can be a security issue...since there
--> is none ;-)
-->
--> db.txt
--> d:\Temp\php4EE.tmp
--> 0
-->
--> PHP Warning: move_uploaded_file(d:\)
--> [function.move-uploaded-file]: failed to create stream: No
--> such file or directory in
--> D:\wwwroot\kingmanchamber\secure-area\administration\upload\
--> file_upload.
--> php on line 24 PHP Warning: move_uploaded_file()
--> [function.move-uploaded-file]: Unable to move
--> 'd:\Temp\php4EE.tmp' to 'd:\' in
--> D:\wwwroot\kingmanchamber\secure-area\administration\upload\
--> file_upload.
--> php on line 24
-->
--> --> -----Original Message-----
--> --> From: Stephen Edmonds [mailto:[EMAIL PROTECTED]]
--> --> Sent: Monday, January 20, 2003 12:26 PM
--> --> To: Matt Babineau
--> --> Cc: PHP Windows Helplist
--> --> Subject: Re: [PHP-WIN] Moving an uploaded file keeps failing
--> -->
--> -->
--> --> Currently from what I can see there are a few problems:
--> -->
--> --> The Form:
--> -->
--> --> <form enctype="multipart/form-data" action="<? echo
--> --> $_SERVER['SCRIPT_NAME'];?>" method="post"> Send this file:
--> --> <input name="userfile" type="file"> <input type="submit"
--> --> value="Send File"> </form>
--> -->
--> --> action is not essential if the form is sending to itself
--> --> (okay, maybe thats just me being lazy :p). However, you
--> --> missed out a vital field
--> -->
--> --> <input type="hidden" name="MAX_FILE_SIZE" value="Maximum
--> --> file size in bytes">
--> -->
--> --> This needs to appear just before the file upload input. It
--> --> tells PHP what the biggest size of file to accept is.
--> --> Without it, no file will be uploaded! Remember to change
--> --> the value to an actual number
--> -->
--> --> Upload Script
--> -->
--> --> You should be using $_FILES array when uploading a file.
--> -->
--> --> $_FILES["userfile"]["name"] - Orginal name of the file
--> --> uploaded, given by the user
--> -->
--> --> $_FILES["userfile"]["error"] - Variable that contains an
--> --> error report. If something goes wrong, a number will get
--> --> put in here. 0 - Upload was okay 1 - The uploaded file
--> --> exceeds the upload_max_filesize directive in php.ini. 2 -
--> --> The uploaded file exceeds the MAX_FILE_SIZE directive that
--> --> was specified in the html form. 3 - The uploaded file was
--> --> only partially uploaded 4 - No file was uploaded
--> -->
--> --> $_FILES["userfile"]["tmp_name"] - This contains the
--> --> location and name of the file which was uploaded
--> -->
--> --> $_FILES['userfile']['type'] - The type of file that was
--> --> uploaded (See link below for more info!)
--> -->
--> --> $_FILES['userfile']['size'] - The size of the newly
--> uploaded file
--> -->
--> --> For more infomation visit
--> --> http://www.php.net/manual/en/features.file-upload.php
--> -->
--> --> It is important to check the error number before you try to
--> --> move the file. Also, rather than checking for 'post', check
--> --> for $_FILES['userfile']['name']
--> -->
--> --> If you still have problems, email the list again with your
--> --> error message/code. Good luck
--> -->
--> --> Stephen
--> -->
--> -->
--> --> ----- Original Message -----
--> --> From: "Matt Babineau" <[EMAIL PROTECTED]>
--> --> To: <[EMAIL PROTECTED]>
--> --> Sent: Monday, January 20, 2003 4:55 PM
--> --> Subject: [PHP-WIN] Moving an uploaded file keeps failing
--> -->
--> -->
--> --> > Here is the error:
--> --> >
--> --> > PHP Warning: move_uploaded_file(/)
--> [function.move-uploaded-file
--> --> > <http://www.php.net/function.move-uploaded-file> ]:
--> --> failed to create
--> --> > stream: No such file or directory in
--> --> >
--> --> D:\wwwroot\kingmanchamber\secure-area\administration\upload\
--> --> file_uploa
--> --> > d.
--> --> > php on line 22 PHP Warning: move_uploaded_file()
--> --> > [function.move-uploaded-file
--> --> > <http://www.php.net/function.move-uploaded-file> ]:
--> Unable to move
--> --> > 'd:\Temp\php443.tmp' to '/' in
--> --> >
--> --> D:\wwwroot\kingmanchamber\secure-area\administration\upload\
--> --> file_upload.
--> --> > php on line 22
--> --> >
--> --> > Here is the code:
--> --> >
--> --> > <form enctype="multipart/form-data" action="<? echo
--> --> > $_SERVER['SCRIPT_NAME'];?>" method="post"> Send this
--> file: <input
--> --> > name="userfile" type="file"> <input type="submit"
--> --> value="Send File">
--> --> > </form>
--> --> >
--> --> > <?
--> --> > if ($_SERVER['REQUEST_METHOD'] == "POST") {
--> --> > echo $_FILES['userfile']['name'] . "<BR>";
--> --> > echo $_FILES['userfile']['tmp_name'] . "<BR>";
--> --> >
--> --> > move_uploaded_file($_FILES['userfile']['tmp_name'], "/");
--> --> >
--> --> > }
--> --> > ?>
--> --> >
--> --> > I am running this on a winxp pro machine iis 5.1, php
--> --> 4.3.0 running as
--> --> > a CGI.
--> --> >
--> --> > This code is pretty much from the PHP.net site, so I am a
--> --> tad baffled
--> --> > on this one.
--> --> >
--> --> > -Matt
--> --> >
--> -->
--> -->
--> -->
--> --> --
--> --> PHP Windows Mailing List (http://www.php.net/)
--> --> To unsubscribe, visit: http://www.php.net/unsub.php
--> -->
--> -->
-->
-->
--> --
--> PHP Windows Mailing List (http://www.php.net/)
--> To unsubscribe, visit: http://www.php.net/unsub.php
-->
-->
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php