[ic] how to remove path from file upload when updating database

Lyn St George interchange-users@icdevgroup.org
Tue Nov 26 13:31:00 2002


On Tue, 26 Nov 2002 08:19:41 -0500, Mike Heins wrote:

>Quoting Lyn St George (lyn@zolotek.net):
>> On Mon, 25 Nov 2002 11:07:47 -0800 (PST), Thanh Luong wrote:
>> 
>> >I have a form which adds new data to a table every
>> >time it is submitted.  On the form there are 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 and have
>> >the path removed.
>> 
>> As you're using this on Windows, therein  lies your problem. This kind 
>> of thing works flawlessly on Unix (Linux, *BSD, Solaris, even on OS/2 ...) 
>> but on Windows all bets are off. You'll find this comment in the faq:
>> " ... there are numerous anomalies and it may be difficult to get [IC on Windows] 
>> operating reliably". Sorry, but that's it. 
>> 
>
>It should work fine on the client side. It begs the question of the browser
>in use, though. I happen to know this type of thing works fine on MSIE
>5 and above....

Resending, as I've just got back that infamous "Your message to 
interchange-users awaits moderator approval" It may be real, as there 
was an attachment, but ...

====================

Thinking about it a little more (through the worst head-cold in history) I 
would hazard a guess that the real culprit is your Windows implementation 
of tar, in conjunction with the attached user-tag. This tag is designed to package 
up any (uncounted) number of these images into a tarball for Stefan Hornburg's
email-mime tag to email to the site owner. As all I know about windows is that 
they break easily, I'll need to bow out of this thread and leave it to others to fix
the code as appropriate for the environment ...

Tag included here (remember KISS .., and it requires "AllowGlobal")
==============

UserTag targzip Order out_tar in
UserTag targzip addAttr
UserTag targzip Interpolate
UserTag targzip Routine <<EOR
sub {
my ($out_tar, $in) = @_;

`tar -cf $out_tar.tar  $in`;
`gzip $out_tar.tar`;
}

EOR

Usertag targzip Documentation <<EOD

This tag takes the input and uses system calls to tar and gzip the input into a
single package. A real-life example of usage:

	a series of images have been uploaded to a website, and they need to be
	emailed on using, for example, Racke's 'email_mime' tag. The images are
	saved on the website in the format:
	[value first_name]_[value last_name].foo.[value-extended foo], which means
	that each image has a unique name but is still easily recognisable as belonging
	to a particular point in a sequence.
	
	[tar_gzip-global "[value first_name]_[value last_name].tar" "[value first_name]_[value 
last_name]*"]
	will produce a package in the format "Joe_Jones.tar.gz".

EOD



>-- 
>Mike Heins
>Perusion -- Expert Interchange Consulting    http://www.perusion.com/
>phone +1.513.523.7621      <mike@perusion.com>

-
Cheers
Lyn St George
+---------------------------------------------------------------------------------
+ http://www.zolotek.net .. eCommerce hosting, consulting
+ http://www.os2docs.org .. some 'How To' stuff ...
+----------------------------------------------------------------------------------