On Mon, October 30, 2006 5:13 am, Børge Holen wrote:
> * First it insert an empty file field (hidden).

This seems silly, but whatever.

> * Second, I  rename all files to an md5 hash.
> * Third, The md5 hash makes legal filenames witch enables my toolset
> to modify
> modify/validate my jpg.

And MD5 hash seems kind of excessive, when you could do:
$filename = preg_replace('/[^a-z0-9_\\.]i/', '', $filename);

But whatever makes you happy.

> The problem I seem to be getting at is this; How do I remove, lets
> say, file
> nr 3 of 6. The input fields can easily (because fields is removed and
> added
> dynamicly) be named everything from 'file_1' to 'file_20'. I only want

Aha!

Try using name="file[1]" instead of "file_1" and your life will become
MUCH simpler.  You can keep your id="file_1" for JS to use
getElementById and muck with what's visible, but your PHP will be
soooo much easier with name="file[1]"

> jpg's
> , so that gif in nr 3 has to be removed before the md5 hash rename.
>
> I could use splice_array to get at it just as I do with the first
> empty one,
> but then again, how do I count down the fields to get to the non valid
> file
> types.

Once you use name="file[3]" there is no count down.
It's an array.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to