Re: I want to upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here are some articles I found on different forums while on uploading files
etc, these should give you a head start.

use the move_uploaded_file ( string filename, string destination)

-> the one below is great it explains it in a very simple manner:
How do I find the file I just uploaded to the webserver and load it?

No matter where the file is uploaded, php will store certain variables for
you containing information about the file.  The full path and filename are
located in the variable with the same name as your file form field.
Let's say you called your file upload field "Picture" and that your Apache
temp directory is /inetpub/tmp/.
In your script, the variable $Picture will contain "/inetpub/tmp/1002.tmp"
where 1002.tmp is the temporary name of the file uploaded.  The variable
$Picture_name will contain the origional file name.
Performing a copy ($Picture, "./images/" . $Picture_name); will put the
image, proper name and all, in the images directory under the script root.
If the security on the server will not allow you to use the copy command,
try the file commmands to create and write a new file: (fopen, fread,
fwrite).  If the server security will not allow that command either, try
putting the images into a blob or binary field in your database.

->Here is an example of a script i found from some  foroum :
<?php

// Complete working file upload example, Win2KPro, Apache 1.3x, PHP 4.x

// Set this line in php.ini
// upload_tmp_dir = /Library/WebServer/yourURL.com/upload_directory/

function handleupload() {
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {

$realname = $_FILES['userfile']['name'];
print "<b>$realname</b> was uploaded successfuly to the upload directory";

print "";

copy($_FILES['userfile']['tmp_name'],
"/Library/WebServer/yourURL.com/upload_directory/".$realname);
} else {
echo "Possible file upload attack: filename
".$_FILES['userfile']['name'].".";
}
}

?>
Good luck with it, I my self is a newbie hope it helps you.


GD
"Quique Notelodigo" <clio_5000@hotmail.com> wrote in message
F73xw8Zw5V6QcqnWwAe0000035e@hotmail.com">news:F73xw8Zw5V6QcqnWwAe0000035e@hotmail.com...
> I want to upload a image, from the client, to the server.
>
> I use PHP and MySQL and Apache in the server.
>
> ¿How can I do it?
>
> _________________________________________________________________
> Charla con tus amigos en línea mediante MSN Messenger:
> http://messenger.microsoft.com/es
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux