[ic] file/image upload with table update problem

Thanh Luong interchange-users@icdevgroup.org
Thu Nov 21 13:19:01 2002


I have a form which adds new data to a table every
time it is submitted.  On the form there is some
<input type=file ...> everytime the "Browse" button is
clicked the name reads C:\somedir\somefile.jpg and
thus the database table records
C:\somedir\somefile.jpg. I would like the database to
record only the last portion, somefile.jpg.
I manage to get the file name to upload as the last
portion only  instead of C:\somedir\somefile.jpg, but
I cant get the table to record it properly. Any
suggestions on how I could go about this.
-----------------------------------------
here is my CODE:

<FORM ACTION="[process-target secure=1]" METHOD="POST"
ENCTYPE="multipart/form-data">
<INPUT TYPE=hidden NAME=mv_session_id VALUE="[data
session id]">
<INPUT TYPE=hidden NAME=mv_click
VALUE="update_database"> 
<INPUT TYPE=hidden NAME=mv_todo VALUE="set"> 
<INPUT TYPE=hidden NAME=mv_nextpage VALUE="output">
<INPUT TYPE=HIDDEN NAME=mv_data_table
VALUE="car_of_the_week_db">
<INPUT TYPE=HIDDEN NAME=mv_data_function
VALUE="insert">
<INPUT TYPE=HIDDEN NAME=mv_data_key VALUE="code">
<input type=hidden name=mv_data_fields
value="code,....">
<input type=hidden name=code value="NULL">
<input type=hidden name="mv_action" value=return>

<input type=text .....>
<input type=file name=img_general value="[value
img_general]">
----------------------------------
on the output page I have the following if it helps:
[if value img_general]
	[set name=upload_filename interpolate=1][calc]
	$filename = "";
	$filename = $CGI->{img_general};
	$filename =~ s|.*[\\/]||;
	return $filename;
	[/calc][/set]
	[scratch upload_filename]=[value-extended Yes=Yes
No=No name=img_general
	 umask=022
	    outfile="pix/[scratch upload_filename]"]
[/if]
 
<!-- the last portion I got from the everhelpful
archive. :-) -->


if you have any ideas, please help and thanks in
advance,
Tom

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com