Re: upload problem ...
| From: | Jonathan Hilgeman | Date: | Mon, 16 Jul 2001 17:09:48 +0000 |
| Subject: | Re: upload problem ... | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10455@lists.php.net to get a copy of this message | ||
Make sure you have ENCTYPE="multipart/form-data" in the <FORM> tag,
otherwise it will not work. You should have a begin and end <FORM> tag and
make sure it has the ENCTYPE attribute, and the METHOD='POST' and the ACTION
attribute filled in, too.
"Comp.Mail.Sendmail" <alfredo@sankofasystems.com> wrote in message
news:20010713213749.33510.qmail@pb1.pair.com...
> 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" <jhilgeman@ecx.com> wrote in message
> news:20010713174913.61752.qmail@pb1.pair.com...
> >
> > File 1 (whateverform.php):
> > ------------------------------------
> > <FORM ENCTYPE="multipart/form-data"
> > ACTION="fileupload-destination.php"
> > METHOD=POST>
> > <INPUT TYPE='File' NAME='alfredoUpload'>
> > </FORM>
> > ------------------------------------
> >
> >
> > 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:alfredo@sankofasystems.com]
> > Sent: Friday, July 13, 2001 10:28 AM
> > To: php-db@lists.php.net
> > 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.
> >
> >
>
>