![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Ok I am trying to get these loops figured out I have 10 files $_FILES['pic1-10'] I need to to run str_replace on all 10 to eliminate any oddities " ","%20" to clean up the filenames before inserting names in db. foreach ($_FILES as $n) { $name=$n["name"] str_replace( " ", "",$name) now how do I get it read back into $_FILES['pic1']['name'] ??? Eric Rackspeed.net | |||
| Advertisements |
| | #2 | ||
| "Eric Haskins" <eric.haskins@rackspeed.net> wrote in message news > Ok I am trying to get these loops figured out > > I have 10 files $_FILES['pic1-10'] > > I need to to run str_replace on all 10 to eliminate any oddities " ","%20" > to clean up the filenames before inserting names in db. > > foreach ($_FILES as $n) { > $name=$n["name"] > str_replace( " ", "",$name) > > now how do I get it read back into $_FILES['pic1']['name'] ??? > > Eric > Rackspeed.net > Eric, A general technique for handling the write back would be to set a counter inside the foreach loop This could be used to access the sub arrays Viz: $x = 0; foreach ($_FILES as $n) { $name=$n["name"]; str_replace( " ", "",$name); $_FILES[$x]['name'] = $name ; $x++; } This WILL work for user defined arrays but I haven't tried loading a PHP superglobals array as I regard them as read only. HTH Ron | |||
| | #3 | ||
| "Eric Haskins" <eric.haskins@rackspeed.net> schrieb im Newsbeitrag news > Ok I am trying to get these loops figured out > > I have 10 files $_FILES['pic1-10'] > > I need to to run str_replace on all 10 to eliminate any oddities " ","%20" > to clean up the filenames before inserting names in db. > > foreach ($_FILES as $n) { > $name=$n["name"] > str_replace( " ", "",$name) > > now how do I get it read back into $_FILES['pic1']['name'] ??? > > Eric > Rackspeed.net > > You could just urlencode the filenames before inserting them in the db, then you don't have to do complicated things with them... -- Markus | |||
| Featured Websites | ||||
|
![]() |
| Tags: array, loop, str_replace, using, _files |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I sort This array? | Karl McAuley | PHP | 1 | 07-01-2007 3:18 PM |
| How to delete an array key??? | Barton | PHP | 0 | 07-01-2007 3:12 PM |
| wireless local loop for cdma.....by sheetal bhosale | sheetal bhosale | Bluetooth Software and Hardware | 1 | 06-17-2007 1:41 PM |
| Loop Emulation...is it possible? | Abraxas | Software Programming | 0 | 06-12-2007 11:28 PM |
| Mysql result to array | Jaak | Database | 2 | 06-10-2007 12:18 AM |
| Featured Websites | ||||
|