Re: [WebDNA] Need some PHP help

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 103525
interpreted = N
texte = This is great. Where can I sign up for your php-as-a-second-language cour= se? ;) -Dan On Wed, 2 Sep 2009 10:16:20 -0500 Clint Davis wrote: > Translated into English. I'm not sure where some of the variables are = coming from - may be in=20 >the JS or SWF files. >=20 >=20 > On Aug 31, 2009, at 4:17 PM, Patrick McCormick wrote: >=20 >> > if (!empty($_FILES)) { > If the $_FILES variable is not empty... >=20 >> $tempFile =3D $_FILES['Filedata']['tmp_name']; > create a $tempFile variable equal to a temporary file name >=20 >> $targetPath =3D $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'= ; > create a $targetPath variable equal to the document root directory und= er which the current=20 >script is executing plus the designated path >=20 >> $targetFile =3D str_replace('//','/',$targetPath) . =20 >> $_FILES['Filedata']['name']; > create a $targetFile variable equal to the path (with // converted to = /) plus the file name >=20 >> // $fileTypes =3D str_replace('*.','',$_REQUEST['fileext']); > create a $fileTypes variable equal to the $fileext form variable (with = *. converted to blank) >=20 >> // $fileTypes =3D str_replace(';','|',$fileTypes); > update the $fileTypes variable with ; replaced by | >=20 >> // $typesArray =3D split('\|',$fileTypes); > create an array name $typesArray by splitting the $fileTypes variable = using a | delimiter >=20 >> // $fileParts =3D pathinfo($_FILES['Filedata']['name']); > create an array named $fileParts by splitting the upload path variable = using a / delimiter > this includes the directory name, base name, file extension, and file = name >=20 >> // if (in_array($fileParts['extension'],$typesArray)) { > if the extension of the uploaded file is found in the $typesArray... >=20 >> // Uncomment the following line if you want to make the directory =20 >> if it doesn't exist >> // mkdir(str_replace('//','/',$targetPath), 0755, true); > create a directory based on the $targetPath variable (with // replaced = by /) and set=20 >permissions to 755 >=20 >> move_uploaded_file($tempFile,$targetFile); > move (or rename) the uploaded file from the $tempFile name to the $tar= getFile name >=20 >> echo "1"; > display '1' on the page >=20 >> // } else { > if the extension of the uploaded file is NOT found in the $typesArray..= . >=20 >> // echo 'Invalid file type.'; > display 'Invalid file type.' on the page >=20 >> // } >> } >> ?> >=20 Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Need some PHP help ("Dan Strong" 2009)
  2. Re: [WebDNA] Need some PHP help (Clint Davis 2009)
  3. Re: [WebDNA] Need some PHP help ("Dan Strong" 2009)
  4. Re: [WebDNA] Need some PHP help (Clint Davis 2009)
  5. Re: [WebDNA] Need some PHP help (Patrick McCormick 2009)
  6. Re: [WebDNA] Need some PHP help (Steve Craig 2009)
  7. Re: [WebDNA] Need some PHP help (Govinda 2009)
  8. [WebDNA] Need some PHP help (Patrick McCormick 2009)
This is great. Where can I sign up for your php-as-a-second-language cour= se? ;) -Dan On Wed, 2 Sep 2009 10:16:20 -0500 Clint Davis wrote: > Translated into English. I'm not sure where some of the variables are = coming from - may be in=20 >the JS or SWF files. >=20 >=20 > On Aug 31, 2009, at 4:17 PM, Patrick McCormick wrote: >=20 >> > if (!empty($_FILES)) { > If the $_FILES variable is not empty... >=20 >> $tempFile =3D $_FILES['Filedata']['tmp_name']; > create a $tempFile variable equal to a temporary file name >=20 >> $targetPath =3D $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'= ; > create a $targetPath variable equal to the document root directory und= er which the current=20 >script is executing plus the designated path >=20 >> $targetFile =3D str_replace('//','/',$targetPath) . =20 >> $_FILES['Filedata']['name']; > create a $targetFile variable equal to the path (with // converted to = /) plus the file name >=20 >> // $fileTypes =3D str_replace('*.','',$_REQUEST['fileext']); > create a $fileTypes variable equal to the $fileext form variable (with = *. converted to blank) >=20 >> // $fileTypes =3D str_replace(';','|',$fileTypes); > update the $fileTypes variable with ; replaced by | >=20 >> // $typesArray =3D split('\|',$fileTypes); > create an array name $typesArray by splitting the $fileTypes variable = using a | delimiter >=20 >> // $fileParts =3D pathinfo($_FILES['Filedata']['name']); > create an array named $fileParts by splitting the upload path variable = using a / delimiter > this includes the directory name, base name, file extension, and file = name >=20 >> // if (in_array($fileParts['extension'],$typesArray)) { > if the extension of the uploaded file is found in the $typesArray... >=20 >> // Uncomment the following line if you want to make the directory =20 >> if it doesn't exist >> // mkdir(str_replace('//','/',$targetPath), 0755, true); > create a directory based on the $targetPath variable (with // replaced = by /) and set=20 >permissions to 755 >=20 >> move_uploaded_file($tempFile,$targetFile); > move (or rename) the uploaded file from the $tempFile name to the $tar= getFile name >=20 >> echo "1"; > display '1' on the page >=20 >> // } else { > if the extension of the uploaded file is NOT found in the $typesArray..= . >=20 >> // echo 'Invalid file type.'; > display 'Invalid file type.' on the page >=20 >> // } >> } >> ?> >=20 "Dan Strong"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCat2 - Getting to the browser's username/password data (1997) emailer w/F2 (1997) Authenticate (1997) Huge databases and RAM (1998) Bug: MySQL WebDNA 6 int bigint fail case (2004) Sorting by date (1997) [Semi-OT] Eaaaaaasy OSX FTP (2003) The List is Changing (1997) Exclude by date - multiple (1997) Search in 2 or more catalogs (1997) WebDNA vs SQL ? (2002) Thanks and Big News!!! (1997) How can I record purchases to a database? (1998) One other big addition... (1997) Erotic Sites (1997) How old am I? (2004) Beta version-Mac? (was Emailer update for Mac?) (1998) docs for WebCatalog2 (1997) [append] and SSL (1997) Re:Emailer tracking (1997)