Hello All,
I'm trying to establish a form where a user is able to select a file they want to upload to my server. However, my form has multiple steps involved, and I would like to have the user select the file they want uploaded, go through a few more steps and then, when they click the final submit, it uploads the file. Is there a way to do this? I've got the script working perfectly if I upload straight away, but am unable to hold it until later. Any advice?
Code:
To Process the form i use:
And then later when i upload it i do this
I'm trying to establish a form where a user is able to select a file they want to upload to my server. However, my form has multiple steps involved, and I would like to have the user select the file they want uploaded, go through a few more steps and then, when they click the final submit, it uploads the file. Is there a way to do this? I've got the script working perfectly if I upload straight away, but am unable to hold it until later. Any advice?
Code:
Code:
<form action="computer" name="custom" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5242880" />
<input name="uploadedfile" type="file" size="30" />
</form>
To Process the form i use:
Code:
$target_path = "files/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_SESSION['target_path'] = $target_path;
$_SESSION['tempinfo'] = $_FILES['uploadedfile']['tmp_name'];
Code:
if(move_uploaded_file($_SESSION['tempinfo'], $_SESSION['target_path'])) {
echo "The file has been uploaded!";
} else{
echo "There was an error uploading the file, please try again!";
}