Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file uploads via php (tough one)

Status
Not open for further replies.

lothadio

Programmer
Apr 5, 2001
27
SI
I will try to explain this completely(I hope you have time)

*****************this is my first page(includes my form)*************************


<?
include(&quot;header.php&quot;);
include(&quot;session.php&quot;);
?>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<head>


<title>Form Add Procedure Documents</title>


<style>
<?
include(&quot;style_sheet.html&quot;);
?>
</style>



</head>




<body>



<div align=&quot;center&quot;>


<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;>
<tr>
<form ENCTYPE= &quot;multipart\form-data&quot; method=&quot;post&quot; action=&quot;add_document_preview_procedure.php&quot;>
<input type=&quot;hidden&quot; name=&quot;session_id&quot; value=&quot;<? echo (&quot;$session_id&quot;) ?>&quot;>

<td align=&quot;left&quot; width=&quot;15%&quot;>Document Number</td>


<td width=&quot;5%&quot; align=&quot;left&quot;>
<select name=&quot;group_number&quot; maxlength=&quot;2&quot;>


<?

$doc_number_1=mssql_query(&quot;SELECT [group]
FROM [group_number]&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row=mssql_fetch_array($doc_number_1)) {
$c1=$row[&quot;group&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print(&quot;</option>&quot;);

}
?>
</select></td>


<td width=&quot;5%&quot; align=&quot;left&quot;>
<select name=&quot;chapter_number&quot; maxlength=&quot;2&quot;>

<?
$doc_number_chapter=mssql_query(&quot;SELECT [chapter]
FROM [chapter_number]&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row=mssql_fetch_array($doc_number_chapter)) {
$c1=$row[&quot;chapter&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print(&quot;</option>&quot;);

}
?>
</select></td>





<td width=&quot;5%&quot; align=&quot;left&quot;>
<select name=&quot;procedure_number&quot; maxlength=&quot;2&quot;>



<?

$doc_number_procedure=mssql_query(&quot;SELECT [procedure]
FROM [procedure_number]&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row=mssql_fetch_array($doc_number_procedure)) {
$c1=$row[&quot;procedure&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print(&quot;</option>&quot;);

}
?>

</select></td>


<td width=&quot;70%&quot; align=&quot;left&quot;>
<select name=&quot;serial_number&quot; maxlength=&quot;2&quot;>
<?

$doc_number_serial=mssql_query(&quot;SELECT [serial]
FROM [serial_number]&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row=mssql_fetch_array($doc_number_serial)) {
$c1=$row[&quot;serial&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print(&quot;</option>&quot;);

}
?>
</select></td>



</tr>
</table>

<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>

<tr>
<td width=&quot;15%&quot; align=&quot;left&quot;>Document Title</td>

<td width=&quot;85%&quot; align=&quot;left&quot;><input type=&quot;text&quot; name=&quot;document_title&quot; size=&quot;50&quot; maxlength=&quot;75&quot;></td>
</tr>

</table>

<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>

<tr>
<td align=&quot;left&quot; width=&quot;15%&quot; valign=&quot;top&quot;>Link Document</td>
<td align=&quot;left&quot; width=&quot;85%&quot;>
<select name=&quot;link_document[]&quot; multiple size=&quot;10&quot; maxlength=&quot;1000&quot; >

<option selected>NONE</option>

<?


$link=mssql_query(&quot;SELECT [Document Number], [Document Title], [auto_increment]
FROM [LINK_TEMP]
&quot;)
OR DIE (&quot;Query LINK Failed&quot;);

WHILE($row=mssql_fetch_array($link))

{
$c1=$row[&quot;Document Number&quot;];
$c2=$row[&quot;Document Title&quot;];
$c3=$row[&quot;auto_increment&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print (&quot;     &quot;); echo(&quot;$c2&quot;); print(&quot;</option>&quot;);



}



?>

</select>










</table>

<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>


<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Reason</td>
<td width=&quot;85%&quot; align=&quot;left&quot; valign=&quot;top&quot;>
<select name=&quot;reasons[]&quot; multiple>

<option selected>NONE</option>
<?

$link=mssql_query(&quot;SELECT [Reason], [auto_increment]
FROM [Reasons]
&quot;)
OR DIE (&quot;Query LINK Failed&quot;);

WHILE($row=mssql_fetch_array($link)) {
$c1=$row[&quot;Reason&quot;];
$c2=$row[&quot;auto_increment&quot;];



print (&quot;<option>&quot;); echo (&quot;$c1&quot;); print(&quot;</option>&quot;);

}
?>

</select></TD>

</table>

<br class=&quot;spacer&quot;>
<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Purpose</td>

<td width=&quot;85%&quot; align=&quot;left&quot;><input type=&quot;text&quot; name=&quot;purpose&quot; size=&quot;50&quot; maxlength=&quot;100&quot;></input></td>

</tr>
</table>

<br class=&quot;spacer&quot;>
<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Scale</td>

<td width=&quot;85%&quot; align=&quot;left&quot;><input type=&quot;text&quot; name=&quot;scale&quot; size=&quot;50&quot; maxlength=&quot;100&quot;></input></td>

</tr>
</table>
<br class=&quot;spacer&quot;>
<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Responsibilities</td>

<td width=&quot;85%&quot; align=&quot;left&quot;><textarea name=&quot;responsibilities&quot; rows=&quot;10&quot; cols=&quot;50&quot; wrap=&quot;hard&quot;></textarea></td>

</tr>
</table>
<br class=&quot;spacer&quot;>
<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Comments/Notes</td>

<td width=&quot;85%&quot; align=&quot;left&quot;><textarea name=&quot;comments&quot; rows=&quot;5&quot; cols=&quot;50&quot; wrap=&quot;hard&quot;></textarea></td>

</tr>
</table>


<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;>Attachments</td>

<input type=&quot;File&quot; name=&quot;userfile&quot; size=&quot;30&quot; maxlength=&quot;255&quot;>
</td>

</tr>
</table>


<table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>

<td width=&quot;15%&quot; align=&quot;left&quot; valign=&quot;top&quot;><input type=&quot;submit&quot; name=&quot;submit&quot; wrap=&quot;hard&quot;></td>


</tr>
</table>






</form>

<div align=&quot;center&quot;>
</body>
</html>






*******************second page****************





<?
include(&quot;header.php&quot;);
include(&quot;session.php&quot;);

//check MAIN and temp_approval for duplicate document_numbers
$document_number = (&quot;$group_number$chapter_number$procedure_number$serial_number&quot;);

$doc_main=mssql_query(&quot;SELECT document_number
FROM final_main
WHERE document_number = '$document_number'
&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row=mssql_fetch_array($doc_main)) {
$c1=$row[&quot;document_number&quot;];

$result=$c1;

}

if(empty($result))
{

$result=&quot;0&quot;;
}

else

{
$result=$result;
}



if ($document_number == $result)

{
HEADER(&quot;LOCATION:error_add_document.php&quot;);
}






$doc_temp=mssql_query(&quot;SELECT document_number
FROM temp_approval
WHERE document_number = '$document_number'
&quot;)
OR DIE (&quot;Query LINK Failed&quot;);
WHILE($row2=mssql_fetch_array($doc_temp)) {
$c2=$row2[&quot;document_number&quot;];

$result_temp=$c2;

}

if(empty($result_temp))
{

$result_temp=&quot;0&quot;;
}

else

{
$result=$result_temp;
}

if ($document_number == $result)

{
HEADER(&quot;LOCATION:error_add_document.php&quot;);
}

?>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<title>
Add Document Preview Procedure
</title>

<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=Windows-1250&quot;>
<script language=JavaScript src=&quot;menu.js&quot;></script>
</head>
<style>

<?
include(&quot;style_sheet.html&quot;);
?>

</style>

<body topmargin=&quot;0&quot; leftmargin=&quot;0&quot;>

<?
$date= date(&quot;m-d-y&quot;);
?>

<table width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;100%&quot;>
<table width=&quot;100%&quot; height=&quot;43&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td>
<table width=&quot;219&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;219&quot;>
<div valign=&quot;bottom&quot;>
<a href=&quot;index.php?session_id=<? echo $session_id ?>&quot;><img src=&quot;images/dhllogo.gif&quot; width=&quot;219&quot; height=&quot;43&quot; alt=&quot;Dobrodošli na intranetnih straneh DHL-a&quot; border=&quot;0&quot;></a></div>
</td>
</tr>
</table>
</td>
<td width=&quot;279&quot; align=&quot;right&quot;>
<table width=&quot;279&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;279&quot;>
<div valign=&quot;bottom&quot;>
<img src=&quot;images/airplane.gif&quot; width=&quot;279&quot; height=&quot;43&quot; alt=&quot;&quot; border=&quot;0&quot;></div>
</td>
</tr>
</table>
</td>
</tr>
</table>

<table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;260&quot; bgcolor=&quot;#990000&quot;>
<table width=&quot;280&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td valign=&quot;middle&quot; width=&quot;280&quot; height=&quot;20&quot; bgcolor=&quot;#990000&quot; class=&quot;mnulnk1&quot;>
 
<!--a href=&quot;navigation_add_document.php?session_id=<? echo $session_id ?>&quot; class=&quot;mnulnk&quot;>Create</a> 
<a href=&quot;navigation_find_revise_document.php?session_id=<? echo $session_id ?>&quot; class=&quot;mnulnk&quot;>Revise</a> 
<a href=&quot;navigation_find_approval_add_documents.php?session_id=<? echo $session_id ?>&quot; class=&quot;mnulnk&quot;>Approve</a>
<a href=&quot;navigation_find_final_approval_add_documents.php?session_id=<? echo $session_id ?>&quot; class=&quot;mnulnk&quot;>Final Approval</a--> 

</td>
<td width=&quot;1&quot;></td>
</tr>
</table>
</td>
<td width=&quot;60%&quot;>
<table width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<tr>
<td height=&quot;20&quot; bgcolor=&quot;#990000&quot;> 
<!--div valign=&quot;bottom&quot;>
<img class=&quot;img1&quot; src=&quot;../images/barend.gif&quot; width=&quot;72&quot; height=&quot;20&quot; alt=&quot;&quot; border=&quot;0&quot;></div-->
</td>
</tr>
</table>
</td>
<td width=&quot;322&quot; align=&quot;right&quot; bgcolor=&quot;#ffffff&quot;>
<table align=&quot;right&quot; width=&quot;279&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;322&quot; height=&quot;20&quot;>
<div valign=&quot;bottom&quot;>
<img src=&quot;images/midprocpv.gif&quot; width=&quot;322&quot; height=&quot;20&quot; alt=&quot;&quot; border=&quot;0&quot;></div>
</td>
</tr>
</table>
</td>
</tr>
</table>


<br><br>
<table align=&quot;center&quot; border=&quot;0&quot; width=&quot;575&quot; height=&quot;910&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td valign=&quot;top&quot;>
<table width=&quot;571&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td>
<table width=&quot;571&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td colspan=&quot;2&quot;><img src=&quot;images/dhllogoPSK.gif&quot; width=&quot;571&quot; height=&quot;37&quot; alt=&quot;&quot; border=&quot;0&quot;>
</td>
</tr>
<tr>
<td colspan=&quot;2&quot;><img src=&quot;images/doctitle.gif&quot; width=&quot;41&quot; height=&quot;14&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext1&quot;>

<?
echo (&quot;$document_title&quot;);
?>
</span>
</td>
</tr>
<tr>
<td width=&quot;351&quot; align=&quot;left&quot;><img src=&quot;images/docnum.gif&quot; width=&quot;127&quot; height=&quot;11&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext2&quot;>

<?
echo (&quot;$document_number&quot;);
?></span>
</td>
<td width=&quot;220&quot; align=&quot;right&quot;><img src=&quot;images/docrev.gif&quot; width=&quot;59&quot; height=&quot;11&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext2&quot;>
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=&quot;575&quot; valign=&quot;top&quot; height=&quot;750&quot;><br>
<table width=&quot;575&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<tr>
<td class=&quot;doctext3&quot; width=&quot;20&quot;> <!-- Number -->
1. 
</td>
<td width=&quot;555&quot; class=&quot;doctext3&quot;> <!-- Sub-Title -->
PURPOSE
</td>
</tr>
<tr>
<td width=&quot;20&quot;> <!-- Empty -->
</td>
<td width=&quot;100%&quot; class=&quot;doctext4&quot;>
<?
echo (&quot;$purpose&quot;);
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
2.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
SCALE
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>
<?
echo (&quot;$scale&quot;);
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
3.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
RESPONSIBILITIES
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>
<?
echo nl2br(&quot;$responsibilities&quot;);
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
4.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
LINK DOCUMENTS
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>
<? //Link Document Array
if (is_array($link_document))
{

while(list($key, $value) = each($link_document))

{
$key++;
eval(&quot;\$variable_$key = '$value';&quot;);
echo (&quot;$value <br>&quot;);
}

}

?>


<?
$counter= 0;

while ($counter <20)
{
$counter++;
$variable_counter=&quot;variable_$counter&quot;;

if(empty($$variable_counter))
{
$$variable_counter = 0;
}
else
{
$$variable_counter = $$variable_counter;
}

if($$variable_counter > 0)
{
echo $$variable_counter;
echo (&quot;<br>&quot;);
}
}
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
5.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
NOTES
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>
<?
echo nl2br($comments);
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
6.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
REASONS
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>
<?

if (is_array($reasons))
{

while(list($key, $value) = each($reasons))

{
$key++;
eval(&quot;\$variable_reasons_$key = '$value';&quot;);
echo (&quot;$value <br>&quot;);
}

}

?>

<?
$counter= 0;

while ($counter <9)
{
$counter++;
$reasons_counter=&quot;variable_reasons_$counter&quot;;

if(empty($$reasons_counter))
{
$$reasons_counter = 0;
}
else
{
$$reasons_counter = $$reasons_counter;
}

if($$reasons_counter > 0)
{
echo $$reasons_counter;
echo (&quot;<br>&quot;);
}
}
?>
<p>

</td>
</tr>
<tr>
<td width=&quot;20&quot; class=&quot;doctext3&quot;> <!-- Number -->
7.
</td>
<td class=&quot;doctext3&quot;> <!-- Sub-Title -->
ATTACHMENTS / PROCESS
</td>
</tr>
<tr>
<td> <!-- Empty -->
</td>
<td class=&quot;doctext4&quot;>





<?
echo (&quot;<image src=$userfile>&quot;);
?>
<p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign=&quot;bottom&quot;>
<table width=&quot;571&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td>
<table width=&quot;571&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;571&quot;><img src=&quot;images/dhlstripe.gif&quot; width=&quot;571&quot; height=&quot;8&quot; alt=&quot;&quot; border=&quot;0&quot;>
</td>
</tr>
<tr>
<td width=&quot;571&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;50%&quot; colspan=&quot;2&quot; align=&quot;left&quot;><img src=&quot;images/docauth.gif&quot; width=&quot;51&quot; height=&quot;16&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext5&quot;><?
echo ($visitor_id);
?></span>
</td>
<td width=&quot;50%&quot; align=&quot;right&quot;>
<img src=&quot;images/docappr.gif&quot; width=&quot;69&quot; height=&quot;16&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext5&quot;>Pending</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=&quot;571&quot; bgcolor=&quot;#ffffff&quot;>
<table width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;225&quot;>
</td>
<td width=&quot;125&quot; align=&quot;center&quot; class=&quot;doctext2&quot;>
</td>
<td width=&quot;225&quot; align=&quot;right&quot;><img src=&quot;images/docdate.gif&quot; width=&quot;35&quot; height=&quot;11&quot; alt=&quot;&quot; border=&quot;0&quot;>
<span class=&quot;doctext2&quot;>

<?
echo ($date);
?></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

<br><br>
<!-- Set style to print on next page -->
<div style=&quot;page-break-before: always&quot; align=&quot;center&quot; class=&quot;lnkbracket&quot;>


<form ENCTYPE= &quot;multipart\form-data&quot; method=&quot;post&quot; action=&quot;approval_script.php&quot;>
<INPUT TYPE=hidden name=MAX_FILE_SIZE value=100000>
<input type=&quot;hidden&quot; name=&quot;session_id&quot; value=&quot;<? echo(&quot;$session_id&quot;) ?>&quot;>

<a href=&quot;JavaScript:history.back(1)&quot;><img width=&quot;70&quot; height=&quot;21&quot; src=&quot;images/back1.gif&quot; alt=&quot;previous page&quot; border=&quot;0&quot;></a>  


<?
//pass document_number to approval_script.php
echo (&quot;<input type=hidden name=document_number value=\&quot;$document_number\&quot;>&quot;);
//pass document_title to approval_script.php
echo (&quot;<input type=hidden name=document_title value=\&quot;$document_title\&quot;>&quot;);
//pass link_documents to approval_script.php
echo (&quot;<input type=hidden name=variable_1 value=\&quot;$variable_1\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_2 value=\&quot;$variable_2\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_3 value=\&quot;$variable_3\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_4 value=\&quot;$variable_4\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_5 value=\&quot;$variable_5\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_6 value=\&quot;$variable_6\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_7 value=\&quot;$variable_7\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_8 value=\&quot;$variable_8\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_9 value=\&quot;$variable_9\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_10 value=\&quot;$variable_10\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_11 value=\&quot;$variable_11\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_12 value=\&quot;$variable_12\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_13 value=\&quot;$variable_13\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_14 value=\&quot;$variable_14\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_15 value=\&quot;$variable_15\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_16 value=\&quot;$variable_16\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_17 value=\&quot;$variable_17\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_18 value=\&quot;$variable_18\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_19 value=\&quot;$variable_19\&quot;>&quot;);
echo (&quot;<input type=hidden name=variable_20 value=\&quot;$variable_20\&quot;>&quot;);
//pass reasons to approval_script.php
echo (&quot;<input type=hidden name=reasons_1 value=\&quot;$variable_reasons_1\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_2 value=\&quot;$variable_reasons_2\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_3 value=\&quot;$variable_reasons_3\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_4 value=\&quot;$variable_reasons_4\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_5 value=\&quot;$variable_reasons_5\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_6 value=\&quot;$variable_reasons_6\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_7 value=\&quot;$variable_reasons_7\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_8 value=\&quot;$variable_reasons_8\&quot;>&quot;);
echo (&quot;<input type=hidden name=reasons_9 value=\&quot;$variable_reasons_9\&quot;>&quot;);
//pass purpose to approval_script.php
echo (&quot;<input type=hidden name=purpose value=\&quot;$purpose\&quot;>&quot;);
//pass scale to approval_script.php
echo (&quot;<input type=hidden name=scale value=\&quot;$scale\&quot;>&quot;);

//pass responsibilities to approval_script.php
echo (&quot;<input type=hidden name=responsibilities value=\&quot;&quot;);
echo nl2br($responsibilities);
echo (&quot;\&quot;>&quot;);
//pass comments/notes to approval_script.php
echo (&quot;<input type=hidden name=notes value=\&quot;&quot;);
echo nl2br($comments);
echo (&quot;\&quot;>&quot;);
//pass date to approval_script.php
echo (&quot;<input type=hidden name=date value=\&quot;$date\&quot;>&quot;);

//pass written_by to approval_script.php
echo (&quot;<input type=hidden name=written_by value=\&quot;$visitor_id\&quot;>&quot;);

//pass image to approval_script.php


echo (&quot;<input type=hidden name=userfile value=\&quot;$userfile\&quot;>&quot;);
echo(&quot;<input type=hidden name=newname size=30 maxlength=\&quot;^255\&quot; value=$document_number>&quot;);
?>
<input type=&quot;image&quot; name=&quot;start_approval&quot; border=&quot;0&quot; src=&quot;images/submtbtn.gif&quot;></a>   
</form>
</div>


</div>
<br><br>



</body>
</html>



************************third page(this ncludes the script that is sopose to upload file**************




<?
include(&quot;header.php&quot;);
include(&quot;session.php&quot;);
?>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<head>
<title>Approval Script</title>

<style>
<?
include(&quot;style_sheet.html&quot;);
?>
</style>
</head>

<body>




<!---Approve_Temp Update--->
<?
// inserts doc info into approval_temp
mssql_query(&quot;INSERT INTO temp_approval (document_number, document_title, purpose, responsibilities, notes, scale, date_created, written_by)
VALUES ('$document_number', '$document_title', '$purpose', '$responsibilities', '$notes', '$scale', '$date', '$written_by')
&quot;);

// inserts link_docs into link_doc_temp
mssql_query(&quot;INSERT INTO temp_link_doc (document_number, link_doc_1, link_doc_2, link_doc_3, link_doc_4, link_doc_5, link_doc_6, link_doc_7, link_doc_8, link_doc_9, link_doc_10, link_doc_11, link_doc_12, link_doc_13, link_doc_14, link_doc_15, link_doc_16, link_doc_17, link_doc_18, link_doc_19, link_doc_20)
VALUES ('$document_number', '$variable_1', '$variable_2', '$variable_3', '$variable_4', '$variable_5', '$variable_6', '$variable_7', '$variable_8', '$variable_9', '$variable_10', '$variable_11', '$variable_12', '$variable_13', '$variable_14', '$variable_15', '$variable_16', '$variable_17', '$variable_18', '$variable_19', '$variable_20')
&quot;);

// inserts reasons into into reasons_temp
mssql_query(&quot;INSERT INTO temp_reasons (document_number, reason_1, reason_2, reason_3, reason_4, reason_5, reason_6, reason_7, reason_8, reason_9)
VALUES ('$document_number', '$reasons_1', '$reasons_2', '$reasons_3', '$reasons_4', '$reasons_5', '$reasons_6', '$reasons_7', '$reasons_8', '$reasons_9')
&quot;);
?>

<?
function do_upload($filename,$newname) {
$file = basename($filename);
$tmp_upload_path = &quot;c:\\php\\uploadtemp\\&quot;;
$new_file_name = &quot;c:\\php\\uploadtemp\\&quot;.$newname;
if (!copy($tmp_upload_path.$file, $new_file_name)) echo &quot;failed to copy file<br>\n&quot;;
return;
}
?>

<?php

do_upload($userfile,$newname);
?>
<!---E-mail Notification to Lucinda--->
<?

mail(&quot;christopher.seidel@jerovsek.si&quot; ,&quot;Add Document Request&quot;,








&quot;<body topmargin=\&quot;0\&quot; leftmargin=\&quot;0\&quot;>

<table width=\&quot;100%\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot;>
<tr>
<td width=\&quot;100%\&quot;>
<table width=\&quot;100%\&quot; height=\&quot;43\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot;>
<tr>
<td>
<table width=\&quot;219\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot;>
<tr>
<td width=\&quot;219\&quot;>
<div valign=\&quot;bottom\&quot;>
<a href=\&quot;index.php?session_id=<? echo $session_id ?>\&quot;><img src=\&quot;C:\\Inetpub\\ width=\&quot;219\&quot; height=\&quot;43\&quot; alt=\&quot;Dobrodošli na intranetnih straneh DHL-a\&quot; border=\&quot;0\&quot;></a></div>
</td>
</tr>
</table>
</td>
<td width=\&quot;279\&quot; align=\&quot;right\&quot;>
<table width=\&quot;279\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot;>
<tr>
<td width=\&quot;279\&quot;>
<div valign=\&quot;bottom\&quot;>
<img src=\&quot;C:\\Inetpub\\ width=\&quot;279\&quot; height=\&quot;43\&quot; alt=\&quot;\&quot; border=\&quot;0\&quot;></div>
</td>
</tr>
</table>
</td>
</tr>
</table>

<table width=\&quot;100%\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot;>
<tr>
<td width=\&quot;260\&quot; bgcolor=\&quot;#990000\&quot;>
<table width=\&quot;260\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot;>
<tr>
<td valign=\&quot;middle\&quot; width=\&quot;260\&quot; height=\&quot;20\&quot; bgcolor=\&quot;#990000\&quot; class=\&quot;mnulnk1\&quot;>
 

</td>
<td width=\&quot;1\&quot;></td>
</tr>
</table>
</td>
<td width=\&quot;60%\&quot;>
<table width=\&quot;100%\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot;>
<tr>
<td height=\&quot;20\&quot; bgcolor=\&quot;#990000\&quot;> 
<!--div valign=\&quot;bottom\&quot;>
<img class=\&quot;img1\&quot; src=\&quot;C:\\Inetpub\\ width=\&quot;72\&quot; height=\&quot;20\&quot; alt=\&quot;\&quot; border=\&quot;0\&quot;></div-->
</td>
</tr>
</table>
</td>
<td width=\&quot;322\&quot; align=\&quot;right\&quot; bgcolor=\&quot;#ffffff\&quot;>
<table align=\&quot;right\&quot; width=\&quot;279\&quot; border=\&quot;0\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot;>
<tr>
<td width=\&quot;322\&quot; height=\&quot;20\&quot;>
<div valign=\&quot;bottom\&quot;>
<img src=\&quot;C:\\Inetpub\\ width=\&quot;322\&quot; height=\&quot;20\&quot; alt=\&quot;\&quot; border=\&quot;0\&quot;></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br><br>
<div align=\&quot;center\&quot;>
<table width=\&quot;350\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot;>
<tr>
<td width=\&quot;300\&quot; height=\&quot;120\&quot; align=\&quot;right\&quot; valign=\&quot;top\&quot;>
<!-- Data -->
<div align=\&quot;center\&quot; class=\&quot;doctext6\&quot;>
$visitor_id has requested document: <b>$document_number</b> to be added to ISO track.
</div>
</td></tr>

<td width=\&quot;300\&quot; height=\&quot;120\&quot; align=\&quot;right\&quot; valign=\&quot;top\&quot;>
<!-- Data -->
<div align=\&quot;center\&quot; class=\&quot;doctext6\&quot;>
<a href=\&quot;http:\\\\127.0.0.1\\dhl\\current_development\\docs.php\&quot;>Approve</a>
</div>
</td></tr>
</table>

</div>


</td>
</tr>
</table>&quot;
,


&quot;Content-type: text/html&quot;);

?>

<?
include(&quot;request_submited.php&quot;);
?>





</body>
</html>




********************conclusion***************

I have 3 layers

layer 1:
The user browses for file to upload(page 1)

layer 2:
The user previews the image along with other <input> fields to be updated to SQL server(page 3)

layer 3:
this is the script that updates SQL SERVER with <input Type=&quot;text&quot;> and also should upload image <inpupt type=&quot;file&quot;> via script.

however I recieve this ERROR

Warning: Unable to open 'c:\php\uploadtemp\airplane.gif' for reading: No such file or directory in c:\inetpub\ on line 46
failed to copy file




I am not sure if I can do this or not?

I hope you can help it would be great!!!!!!!!!!!

Thanks a MILLION in advance

christopher
 
I'd love to help. I really would. But it's nearly impossible to read lengthy source code through Tek-tips. Would it be possible for people with questions necessatating a view of all their HTML and PHP to simply put links here to their pages and .phps sourcefiles?

Just a thought.

brendanc@icehouse.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top