Jump to content

Archived

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

fohanlon

File Upload Full Path for Form Validation

Recommended Posts

Hi Guys,

I have a list of four file input boxes on a form as follows:

<input name="photos[]" type="file" class="formitems" id="photos[]" size="50">
<input name="photos[]" type="file" class="formitems" id="photos[]" size="50">
<input name="photos[]" type="file" class="formitems" id="photos[]" size="50">
<input name="photos[]" type="file" class="formitems" id="photos[]" size="50">

When the form is submitted I run php validation on various other selects and text boxes.  My question is when there are errors on the form how do I POST the original file path back into each of the file input types above.

If there are errors on the form at the moment whatever paths were in the four file input types will clear.

Any help would as always be greatly appreciated.

BTW, I understand the following:

for($i=0; $i<count($_FILES['photos']['tmp_name']); $i++)
{     
$tempname = $_FILES['photos']['tmp_name'][$i]; 
$actual_filename = $_FILES['photos']['name'][$i];
}

but I need the code to get full path entered as explained below.

Many thanks,

Fergal.

Share this post


Link to post
Share on other sites
if there is an errow use exit; with a link to let the user try agin.

Share this post


Link to post
Share on other sites
I don't think there is a way to do this, you could save the temp address, when it's uploaded and try to echo it back on itself if it's on the same page if it's different pages however there is one thing.  Register sessions on each and every variable, then put the sessions back into the form on the other page, in the php ini put like 1 hour, it'll make sure the variables stay in place for that person

Share this post


Link to post
Share on other sites

×

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.