Re: [WebDNA] Need some PHP help
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 103527
interpreted = N
texte = Wow, I never would have thought to look at the php manual to learn php. T=hanks, I think.-DanOn Wed, 2 Sep 2009 14:01:29 -0500 Clint Davis
wrote:> This is a good starting place: http://www.php.net/manual/en/>=20>=20> On Sep 2, 2009, at 11:45 AM, Dan Strong wrote:>=20>> This is great. Where can I sign up for your php-as-a-second-language =20>> course? ;)>> -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 =20>>> are coming from - may be in the JS or SWF files.>>> On Aug 31, 2009, at 4:17 PM, Patrick McCormick wrote:>>>> >>> if (!empty($_FILES)) {>>> If the $_FILES variable is not empty...>>>> $tempFile =3D $_FILES['Filedata']['tmp_name'];>>> create a $tempFile variable equal to a temporary file name>>>> $targetPath =3D $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . =20>>>> '/';>>> create a $targetPath variable equal to the document root directory =20>>> under which the current script is executing plus the designated path>>>> $targetFile =3D str_replace('//','/',$targetPath) . =20>>>> $_FILES['Filedata']['name'];>>> create a $targetFile variable equal to the path (with // converted =20>>> to /) plus the file name>>>> // $fileTypes =3D str_replace('*.','',$_REQUEST['fileext']);>>> create a $fileTypes variable equal to the $fileext form variable =20>>> (with *. converted to blank)>>>> // $fileTypes =3D str_replace(';','|',$fileTypes);>>> update the $fileTypes variable with ; replaced by |>>>> // $typesArray =3D split('\|',$fileTypes);>>> create an array name $typesArray by splitting the $fileTypes =20>>> variable using a | delimiter>>>> // $fileParts =3D pathinfo($_FILES['Filedata']['name']);>>> create an array named $fileParts by splitting the upload path =20>>> variable using a / delimiter>>> this includes the directory name, base name, file extension, and =20>>> file name>>>> // if (in_array($fileParts['extension'],$typesArray)) {>>> if the extension of the uploaded file is found in the $typesArray...>>>> // Uncomment the following line if you want to make the =20>>>> directory if it doesn't exist>>>> // mkdir(str_replace('//','/',$targetPath), 0755, true);>>> create a directory based on the $targetPath variable (with // =20>>> replaced by /) and set permissions to 755>>>> move_uploaded_file($tempFile,$targetFile);>>> move (or rename) the uploaded file from the $tempFile name to the =20>>> $targetFile name>>>> echo "1";>>> display '1' on the page>>>> // } else {>>> if the extension of the uploaded file is NOT found in the =20>>> $typesArray...>>>> // echo 'Invalid file type.';>>> display 'Invalid file type.' on the page>>>> // }>>>> }>>>> ?>>=20>=20>=20
Associated Messages, from the most recent to the oldest:
Wow, I never would have thought to look at the php manual to learn php. T=hanks, I think.-DanOn Wed, 2 Sep 2009 14:01:29 -0500 Clint Davis wrote:> This is a good starting place: http://www.php.net/manual/en/>=20>=20> On Sep 2, 2009, at 11:45 AM, Dan Strong wrote:>=20>> This is great. Where can I sign up for your php-as-a-second-language =20>> course? ;)>> -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 =20>>> are coming from - may be in the JS or SWF files.>>> On Aug 31, 2009, at 4:17 PM, Patrick McCormick wrote:>>>> >>> if (!empty($_FILES)) {>>> If the $_FILES variable is not empty...>>>> $tempFile =3D $_FILES['Filedata']['tmp_name'];>>> create a $tempFile variable equal to a temporary file name>>>> $targetPath =3D $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . =20>>>> '/';>>> create a $targetPath variable equal to the document root directory =20>>> under which the current script is executing plus the designated path>>>> $targetFile =3D str_replace('//','/',$targetPath) . =20>>>> $_FILES['Filedata']['name'];>>> create a $targetFile variable equal to the path (with // converted =20>>> to /) plus the file name>>>> // $fileTypes =3D str_replace('*.','',$_REQUEST['fileext']);>>> create a $fileTypes variable equal to the $fileext form variable =20>>> (with *. converted to blank)>>>> // $fileTypes =3D str_replace(';','|',$fileTypes);>>> update the $fileTypes variable with ; replaced by |>>>> // $typesArray =3D split('\|',$fileTypes);>>> create an array name $typesArray by splitting the $fileTypes =20>>> variable using a | delimiter>>>> // $fileParts =3D pathinfo($_FILES['Filedata']['name']);>>> create an array named $fileParts by splitting the upload path =20>>> variable using a / delimiter>>> this includes the directory name, base name, file extension, and =20>>> file name>>>> // if (in_array($fileParts['extension'],$typesArray)) {>>> if the extension of the uploaded file is found in the $typesArray...>>>> // Uncomment the following line if you want to make the =20>>>> directory if it doesn't exist>>>> // mkdir(str_replace('//','/',$targetPath), 0755, true);>>> create a directory based on the $targetPath variable (with // =20>>> replaced by /) and set permissions to 755>>>> move_uploaded_file($tempFile,$targetFile);>>> move (or rename) the uploaded file from the $tempFile name to the =20>>> $targetFile name>>>> echo "1";>>> display '1' on the page>>>> // } else {>>> if the extension of the uploaded file is NOT found in the =20>>> $typesArray...>>>> // echo 'Invalid file type.';>>> display 'Invalid file type.' on the page>>>> // }>>>> }>>>> ?>>=20>=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:
FW: SQL Error: 00000 (2004)
Problems with [Search] param - Mac Plugin b15 (1997)
Protect and Serve (1999)
[OT] Webmaster Opportunity in Cypress, CA (2003)
more info on [setlineitems] (1997)
Setting up WebCatalog with Retail Pro data (1996)
Test (2006)
Inventory Control (2000)
cc auth with [purchase] (1998)
How do I get multiple unique numbers on one template? (2000)
WCS Newbie question (1997)
[WebDNA] New 7.1.702 version (2012)
RAM variables (1997)
OT: Photo Resources (2002)
WebCat2 - many [carts] on one template page? (1997)
Re:Emailer tracking (1997)
Out of the woodwork (2007)
WebCat2b12 - nesting [tags] (1997)
Swear words (2002)
Deleting Cookie Problems (2007)