Re: Upload File Path Problem
| From: | root | Date: | Fri, 05 Oct 2001 15:49:40 +0000 |
| Subject: | Re: Upload File Path Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70101@lists.php.net to get a copy of this message | ||
$imagefile contains the name of the file in the temp dir. So the name is some
mess like phpxxxxx . If you want the file you do copy() or something other.
After the script is done the file is deleted. I prefer using $HTTP_POST_VARS
do var_dump($HTTP_POST_VARS) to see debug info.
Andrey Hristov
IcyGEN Corporation
Building Solutions
http://www.icygen.com
On Friday 05 October 2001 18:41, you wrote:
> All,
>
> I am putting together a simple upload program where an
> HTML form calls a php script passing a file which is
> then used to upload. I am running this locally
> currently, prior to rolling out to a test server.
>
> My problem is this. The variable $filename I am
> passing from the form to the php script is having the
> path corrupted. In the php script if I echo
> $filename_name the file name is being passed correctly
> (test.txt) but when I echo the $filename variable it
> contains a value of \\php2 when infact the correct
> value should be c:\test.txt.
>
>
> I include below my sample code. If anyone has any
> ideas I would be most grateful.
>
> Thanks in advance,
>
>
> Roger
>
> upload.html
> ==================================
>
> <HTML>
>
> <FORM form enctype="multipart/form-data" METHOD=POST
> ACTION = "uploadrjb.php3" >
> <PRE>
> Upload file : <INPUT TYPE="file" INPUT
> NAME="userfile"><BR>
> Image Description : <INPUT TYPE="text"
> NAME="description" SIZE=40 align="left"><BR>
> First Name : <INPUT TYPE="text" NAME="firstname"
> SIZE=30 align="left"> Last Name: <INPUT TYPE="text"
> NAME="lastname" SIZE=30 align="left"><BR>
> Location : <SELECT NAME="location" >
> <OPTION VALUE ="01">Dagenham</OPTION>
> <OPTION VALUE ="02">Romford</OPTION>
> <OPTION VALUE ="03">Other</OPTION> </SELECT><BR>
> Age : <INPUT TYPE="text" NAME="age" SIZE=2
> ALIGN="right"><BR>
> Email Address : <INPUT TYPE="text" NAME="email"
> SIZE=30 ALIGN="left"><BR>
> <INPUT TYPE=SUBMIT Value="Upload"<BR>
> </PRE>
> </FORM>
>
> </HTML>
>
> uploadrjb.php3
> ==========================================
> <?php
>
> //echo $userfile; <BR>
>
> echo "File=" . "$userfile";
> echo "File=" . $userfile_name;
>
> //echo "Description=" . $description;
> //echo "Age= " . $age;
> //echo "First Name = " . $firstname;
> //echo "Last Name = " . $lastname;
> //echo "Location = ". $location;
> //echo "Email = ". $email;
>
> if ( isset($userfile) ) {
> if ( copy("c:\\" . "$userfile_name",
> "c:\\bollocks.txt") ) {
> echo("<B>File Successfully copied</B>");
> } else {
> echo("<B>Error: Failed to copy file...<B>");
> }
> }
> ?>
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> NEW from Yahoo! GeoCities - quick and easy web site hosting, just
> $8.95/month. http://geocities.yahoo.com/ps/info1