RE: [PHP] images
| From: | (Edward Peloke) | Date: | Thu, 17 Oct 2002 17:30:55 +0000 |
| Subject: | RE: [PHP] images | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120363@lists.php.net to get a copy of this message | ||
Thanks everyone for all the info.
-----Original Message-----
From: Khalid El-Kary [mailto:khalid_kary@hotmail.com]
Sent: Thursday, October 17, 2002 12:08 PM
To: php-general@lists.php.net
Subject: Re: [PHP] images
hi,
first i noted that you wrote action="c:\junk" this won't work if the script
is on the "c:\" drive of your webserver! because this means the script is on
the "c:\" drive of the client ... you should use a relative or full URL
http://www.domain.com/myscript.php
or realtive:
scriptname.php (assuming that the script is on the same path of the HTML
file which contains the form)
different than that your HTML form is okay ...
about the PHP script, after the form is submitted PHP will create an array
for you $_FILES which contain references to the files you uploaded, so to
refer to the file in your form you would write (just to refer to it)
$_FILES['uploadfile']
PHP also provides you with four variables for each uploaded file, infact the
reference to the file is an array itself that contains 4 elements (as i
know)
tmp_name (is the place where PHP temproarily uploaded the file)
name (the original file name)
size (this file size)
type (mime type)
to get the original name of your file you will write (according to your
form)
$_FILES['uploadfile']['name']
to put the file in an intended path use this function
move_uploaded_file($_FILES['uploadfile']['tmp_name'],"/yourpathgoeshere/your
filenamegoeshere.jpg");
you will remark that both the path and the file name are generated by you,
so it's easy to edit them and insert them into the database
if you want to know if there's a file with the same name use the function
file_exists(string filename) and then change the name according to it
you must also refer to the PHP manual
post method uploads:
http://it3.php.net/manual/en/features.file-upload.php#features.file-upload.p
ost-method
File system functions:
http://it3.php.net/manual/en/ref.filesystem.php
khalid
_________________________________________________________________
Unlimited Internet access for only $21.95/month. Try MSN!
http://resourcecenter.msn.com/access/plans/2monthsfree.asp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php