Re: PHP question RH Linux ---a bit ot---

2003-11-06 Thread Greg Rundlett
On linux systems, /tmp will automatically be used I believe.

Anyway, you don't even need to know where the temp location is.  You 
should use the $_FILES super global to access and manipulate the 
uploaded file.  Also, you can set the MAX_FILE_SIZE in a hidden form 
field to tell PHP what limit to accept...

Assuming these form elements (with a file input named 'pvtUploadFile')

   input type=hidden name=MAX_FILE_SIZE value=300
   input type=file name=pvtUploadFile id=pvtUploadFile
   value=?php print $pvtUploadFile; ? class=required
   onChange=if(isItEmpty(this.value))
   {alertMsg(this.form.name,this.name,'You forgot to attach your resume
   file.');} size=40
Here is how you would process it:
 // where do you want it?
 $dgfStore = '/web/server5/hr/resumes/';
 // full path and filename of the 'new' file
 $dgfUploadedFile = $dgfStore . $_FILES['pvtUploadFile']['name'];
 // copy it from the temporary location
 copy($_FILES['pvtUploadFile']['tmp_name'], $dgfUploadedFile);
 // remember other superglobal values in case you want to use them
 $dgfFileName = $_FILES['pvtUploadFile']['name'];
 $dgfFileType = $_FILES['pvtUploadFile']['type'];
 $dgfFileSize = $_FILES['pvtUploadFile']['size'];
nb.
dgf stands for 'data gathering forms' and is a library that I would like 
to find time to share with everyone.  If you're interested, I will 
provide more documentation and code.

- Greg

Jason wrote:

All,

Trying to run an upload script.

?php

if ($userfile==none)

	{

	echo Problem: no file uploaded;

	exit;

	}

if (move_uploaded_file($userfile,/here/.$userfile_name))
 {
 echo your file was loaded successfully;
 exit;
 }
 else
 {
 echo nope;
			 }

?

A look at the configuration /etc/php.ini of PHP4.1.2 shows no value for
upload_tmp_dir should I change this to a proper path? if so do I have to
restart anything?
Any hints?

Jason
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
 



___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: PHP question RH Linux ---a bit ot---

2003-11-06 Thread Erik Price
 
On Thursday, November 06, 2003, at 03:10PM, Greg Rundlett [EMAIL PROTECTED] wrote:


Anyway, you don't even need to know where the temp location is.  You 
should use the $_FILES super global to access and manipulate the 
uploaded file.

Greg's right.

 Also, you can set the MAX_FILE_SIZE in a hidden form 
field to tell PHP what limit to accept...

Of course, be careful not to rely on this for any kind of security, since it's easy 
for a user to send whatever value they wish for the MAX_FILE_SIZE parameter.



Erik
___
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss