Jump to content

Is there a way to determine which file input prompt was used?


kadin

Recommended Posts

 

I can determine which radio button is selected for each file upload prompt because I have a name and a value. So the array name=image can have one of three values for each file upload prompt.

 

Is there a way to determine which of the three file upload prompts was loaded (clicking browse & select image) with an image and which was not? There doesn't seem to be a value like there is with radio buttons. I want to be able to replace an already uploaded image with another.

 

Thanks.

 

<input type='radio' name='image[image0]' value='keep' checked='checked'/>

<input type='radio' name='image[image0]' value='delete' />

<input type='radio' name='image[image0]' value='replace' />

<input type="file" name="image[]" />

 

<input type='radio' name='image[image1]' value='keep' checked='checked'/>

<input type='radio' name='image[image1]' value='delete' />

<input type='radio' name='image[image1]' value='replace' />

<input type="file" name="image[]" />

 

<input type='radio' name='image[image2]' value='keep' checked='checked'/>

<input type='radio' name='image[image2]' value='delete' />

<input type='radio' name='image[image2]' value='replace' />

<input type="file" name="image[]" />

 

if (isset($_POST['submitted']) && 
	($image = $_POST['image'])) {

	foreach($image as $imageKey => $imageValue) {
		if ($imageValue == 'keep') {
			do this	
		}
	}	
}

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.