[PHP-DB] Re: upload problem ...

2001-07-16 Thread Jonathan Hilgeman

Make sure you have ENCTYPE="multipart/form-data" in the  tag,
otherwise it will not work. You should have a begin and end  tag and
make sure it has the ENCTYPE attribute, and the METHOD='POST' and the ACTION
attribute filled in, too.

"Comp.Mail.Sendmail" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have implemented the code even as one file but the php file
> just run without uploading the file to the server, though  i have
> chmod the uploadfolder "tmp" as 777,,
> Any help.Thanks ...
>
> "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > File 1 (whateverform.php):
> > 
> >  > METHOD=POST>
> > 
> > 
> > 
> >
> >
> > File 2 (fileupload-destination.php):
> > 
> > if (is_uploaded_file($alfredoUpload))
> > {
> > // Uncomment the following line ONLY if you're on Red Hat 7.0
> > // $Fix_RH7_Upload = fix_php_rh7_upload_bug($alfredoUpload);
> > // Move to directory
> > $filename = basename ($alfredoUpload_name);
> > move_uploaded_file($alfredoUpload, "/home/mydirectory/uploadfolder/" .
> > $filename);
> > }
> > // #
> > // Fix PHP Upload Bug on Red Hat 7.0
> > // #
> > function fix_php_rh7_upload_bug($tmp)
> > {
> > $infile=fopen($tmp,"r"); // Open the file for the copy
> > $outfile=fopen("$tmp.new","w"); // create a new temp file
> > $header=fgets($infile,255); //get the 1st line (netscape sometimes
doesn't
> > add a Content-type line)
> > //if its more than just a \r\n sequence then
> > if (strlen($header)>2) $header=fgets($infile,255); //get next line also
> > while(!feof($infile))
> > { // Loop through the remaining file
> > $temp=fread($infile,128);
> > fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp
file
> > }
> > fclose($outfile);
> > fclose($infile);
> > copy("$tmp.new","$tmp"); //replace the original with our new bug fixed
> file
> > unlink("$tmp.new"); //and delete the new file
> > return filesize($tmp); //return a true file size
> > }
> > 
> >
> > You can post the upload to the same file if you want (so File 1 AND File
2
> > are whateverform.php). I just split them up for this example. I don't
take
> > credit for the fix_php_rh7_upload_bug function. That was posted by
someone
> > else on the PHP documentation.
> >
> > - Jonathan
> >
> >
> > -Original Message-
> > From: comp.mail.sendmail [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 13, 2001 10:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] upload problem ...
> >
> > Could anyone send me the actual code for doing the files upload to
> > a linux box with php. I know the form for the upload but not the php
file
> > that
> > does the upload .
> > Thanks everyone.
> >
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: upload problem ...

2001-07-13 Thread comp.mail.sendmail

I have implemented the code even as one file but the php file
just run without uploading the file to the server, though  i have
chmod the uploadfolder "tmp" as 777,,
Any help.Thanks ...

"Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> File 1 (whateverform.php):
> 
>  METHOD=POST>
> 
> 
> 
>
>
> File 2 (fileupload-destination.php):
> 
> if (is_uploaded_file($alfredoUpload))
> {
> // Uncomment the following line ONLY if you're on Red Hat 7.0
> // $Fix_RH7_Upload = fix_php_rh7_upload_bug($alfredoUpload);
> // Move to directory
> $filename = basename ($alfredoUpload_name);
> move_uploaded_file($alfredoUpload, "/home/mydirectory/uploadfolder/" .
> $filename);
> }
> // #
> // Fix PHP Upload Bug on Red Hat 7.0
> // #
> function fix_php_rh7_upload_bug($tmp)
> {
> $infile=fopen($tmp,"r"); // Open the file for the copy
> $outfile=fopen("$tmp.new","w"); // create a new temp file
> $header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't
> add a Content-type line)
> //if its more than just a \r\n sequence then
> if (strlen($header)>2) $header=fgets($infile,255); //get next line also
> while(!feof($infile))
> { // Loop through the remaining file
> $temp=fread($infile,128);
> fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file
> }
> fclose($outfile);
> fclose($infile);
> copy("$tmp.new","$tmp"); //replace the original with our new bug fixed
file
> unlink("$tmp.new"); //and delete the new file
> return filesize($tmp); //return a true file size
> }
> 
>
> You can post the upload to the same file if you want (so File 1 AND File 2
> are whateverform.php). I just split them up for this example. I don't take
> credit for the fix_php_rh7_upload_bug function. That was posted by someone
> else on the PHP documentation.
>
> - Jonathan
>
>
> -Original Message-
> From: comp.mail.sendmail [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] upload problem ...
>
> Could anyone send me the actual code for doing the files upload to
> a linux box with php. I know the form for the upload but not the php file
> that
> does the upload .
> Thanks everyone.
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: upload problem ...

2001-07-13 Thread Jonathan Hilgeman


File 1 (whateverform.php):







File 2 (fileupload-destination.php):

if (is_uploaded_file($alfredoUpload))
{
// Uncomment the following line ONLY if you're on Red Hat 7.0
// $Fix_RH7_Upload = fix_php_rh7_upload_bug($alfredoUpload);
// Move to directory
$filename = basename ($alfredoUpload_name);
move_uploaded_file($alfredoUpload, "/home/mydirectory/uploadfolder/" .
$filename);
}
// #
// Fix PHP Upload Bug on Red Hat 7.0
// #
function fix_php_rh7_upload_bug($tmp)
{
$infile=fopen($tmp,"r"); // Open the file for the copy
$outfile=fopen("$tmp.new","w"); // create a new temp file
$header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't
add a Content-type line)
//if its more than just a \r\n sequence then
if (strlen($header)>2) $header=fgets($infile,255); //get next line also
while(!feof($infile))
{ // Loop through the remaining file
$temp=fread($infile,128);
fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file
}
fclose($outfile);
fclose($infile);
copy("$tmp.new","$tmp"); //replace the original with our new bug fixed file
unlink("$tmp.new"); //and delete the new file
return filesize($tmp); //return a true file size
}


You can post the upload to the same file if you want (so File 1 AND File 2
are whateverform.php). I just split them up for this example. I don't take
credit for the fix_php_rh7_upload_bug function. That was posted by someone
else on the PHP documentation.

- Jonathan


-Original Message-
From: comp.mail.sendmail [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 10:28 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] upload problem ...

Could anyone send me the actual code for doing the files upload to
a linux box with php. I know the form for the upload but not the php file
that
does the upload .
Thanks everyone.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]