Jump to content

File Upload Full Path for Form Validation


fohanlon

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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.