[ic] Images uploaded by customers?Help please

Mike Heins interchange-users@interchange.redhat.com
Thu Oct 11 10:43:00 2001


Quoting Alex Daree (Alexdaree@incorruptible.com):
> Hi
> I am trying to build a code where I allow my customers to upload an image to
> the user db. I used this code below and it does upload files but they are
> all 0 size, in other words it uploads the name of the file, not the file.
> Any ideas? Please....
> > [set name=upload_filename interpolate=1][calc]
> > $filename = "";
> > $filename = $CGI->{newfile};
> > $filename =~ s|.*[\\/]||;
> > return $filename;
> > [/calc][/set]
> [value-extended Yes=1 No=0 name=newfile
>  umask=022
>    outfile="images/publicgallery/[scratch upload_filename]"]
> 

I put this code in a randome 4.8 catalog page:

[if value newfile]
	[set name=upload_filename interpolate=1][calc]
	$filename = "";
	$filename = $CGI->{newfile};
	$filename =~ s|.*[\\/]||;
	return $filename;
	[/calc][/set]
	[scratch upload_filename]=[value-extended Yes=Yes No=No name=newfile
	 umask=022
	    outfile="images/[scratch upload_filename]"]
[/if]

<FORM ACTION="@@MV_PAGE@@" METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE=hidden NAME=mv_action VALUE=return>
<INPUT TYPE=file NAME=newfile>
<INPUT TYPE=submit>
</FORM>

Works fine.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Unix version of an Outlook-style virus:
It works on the honor system. Please forward this message to everyone
you know, and delete a bunch of your files at random.