RE: [PHP] Uploading file
| From: | Clemson Chan | Date: | Tue, 03 Sep 2002 23:07:25 +0000 |
| Subject: | RE: [PHP] Uploading file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115115@lists.php.net to get a copy of this message | ||
relative paths work too.
Thank you so much.
--Clemson
-----Original Message-----
From: Rodrigo Dominguez [mailto:mails@rorra.com.ar]
Sent: Tuesday, September 03, 2002 3:55 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Uploading file
You are doing wrong... you are checking for the temp file and after that you
are deleting the temp file, you should copy the files first
This is your code
if(isset($UploadedFile))
{
unlink($UploadedFile); // Here you are deleting the temp file
print("Local File: $UploadedFile <BR>\n");
print("Name: $UploadedFile_name <BR>\n");
print("Size: $UploadedFile_size <BR>\n");
print("Type: $UploadedFile_type <BR>\n");
print("<HR>\n");
}
You should write something like this
if(isset($UploadedFile))
{
copy($UploadedFile, "/uploaded_files/" . $UploadedFile_name); // Here
we first copy the temp file to a secure path, you should change the
/uploaded_files/
// path
print("Local File: $UploadedFile <BR>\n");
print("Name: $UploadedFile_name <BR>\n");
print("Size: $UploadedFile_size <BR>\n");
print("Type: $UploadedFile_type <BR>\n");
print("<HR>\n");
unlink($UploadedFile); // Now we can delete the temp file
}
"Clemson Chan" <clemsonchan@earthlink.net> escribió en el mensaje
news:EIEMKHIHGBNGLICLLCLAEEEECEAA.clemsonchan@earthlink.net...
> Thanks Juan, and other listers,
>
> I have this example,
>
> <HTML>
> <HEAD>
> <TITLE>Figure 7-3</TITLE>
> </HEAD>
> <BODY>
> <?
> //check for file upload
> if(isset($UploadedFile))
> {
> unlink($UploadedFile);
> print("Local File: $UploadedFile <BR>\n");
> print("Name: $UploadedFile_name <BR>\n");
> print("Size: $UploadedFile_size <BR>\n");
> print("Type: $UploadedFile_type <BR>\n");
> print("<HR>\n");
> }
> ?>
> <FORM ENCTYPE="multipart/form-data"
> ACTION="7-3.php" METHOD="post">
> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="4096000">
> <INPUT NAME="UploadedFile" TYPE="file">
> <INPUT TYPE="submit" VALUE="Upload">
> </FORM>
>
> </BODY>
> </HTML>
>
> and the result is this after I uploaded a file
>
> Local File: /tmp/phpnYLV2J
> Name: 323lake.jpg
> Size: 48254
> Type: image/pjpeg
>
> But I couldn't find the uploaded file, nor the /tmp/phpnYLV2J path.
> Do I normally do a copy after the upload?
> Can I just change the tmp path and filename when I upload?
> Thanks.
>
> --Clemson
>
>
>
> -----Original Message-----
> From: Juan Pablo Aqueveque [mailto:juque@uct.cl]
> Sent: Tuesday, September 03, 2002 7:58 AM
> To: Clemson Chan; php-general@lists.php.net
> Subject: Re: [PHP] Uploading file
>
>
> Hi friend,
>
> http://www.php.net/manual/en/features.file-upload.php
> And take a look to the User Contributed Notes
>
> --jp
>
> At 13:03 03-09-2002 -0700, Clemson Chan wrote:
> >Hi, I am new to this group.
> >I am trying to figure out how to let people to upload image files to my
> >website.
> >My ISP is using PHP 3 (I believe).
> >If someone can give me simple example, that will be great.
> >Thanks.
> >
> >--Clemson
> >
> >How can I tell what version of PHP is running on the system (linux)?
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> ________________________________________________________
> Juan Pablo Aqueveque <juque@uct.cl>
> Ingeniero de Sistemas
> Departamento de Redes y Comunicaciones http://www.drc.uct.cl
> Universidad Católica de Temuco.
> Tel:(5645) 205 630 Fax:(5645) 205 628
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php