PHP question RH Linux ---a bit ot---
Greg Rundlett
greg at freephile.com
Thu Nov 6 15:10:38 EST 2003
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="3000000">
<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
>gnhlug-discuss at mail.gnhlug.org
>http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
>
>
>
>
More information about the gnhlug-discuss
mailing list