Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

files upload

Status
Not open for further replies.

jefargrafx

Instructor
May 24, 2001
273
US
I'm tring to teach myself how to upload files via php.

So far so good......but I'm using an array and I do not know the syntax to get a part of the array

_FILES["upload"] Array
(
[name] => music.mp3
[type] => audio/mpeg
[tmp_name] => C:\PHP\uploadtemp\php4E.tmp
[error] => 0
[size] => 7444008
)

I'd like to know if error => 0 so I can do some checking if the file was uploaded or not and send a message back to the user.

How do you wirter something like

if ($_files == "upload" and error => 0) {
do something;
}

thanks in advanced

jef
 
$_FILES['userfile']['name']
The original name of the file on the client machine.

$_FILES['userfile']['type']
The mime type of the file, if the browser provided this information. An example would be "image/gif".

$_FILES['userfile']['size']
The size, in bytes, of the uploaded file.

$_FILES['userfile']['tmp_name']
The temporary filename of the file in which the uploaded file was stored on the server.

$_FILES['userfile']['error']



the name 'userfile' is the name of the input in your form

also check this
 
if ($_FILES["upload"]["error"] != 0) {
call_error();
}else{
move_uploaded_file();
}

Something like that?
 
oh!

I get it, works like a charm thanks so much for the input

jef
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top