[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] s/Reg Exps on file paths/headaches/g ;
Many thanks.
For the record, here's the code that works for those people who, down the
road, are searching the docs trying to do the same:
In the form:
<FORM ACTION="[process-target]" METHOD=POST ENCTYPE="multipart/form-data">
<INPUT TYPE=hidden NAME=mv_todo VALUE=return>
<INPUT TYPE=hidden NAME=mv_nextpage VALUE=test>
<INPUT TYPE=hidden NAME=ui_return_to VALUE="thispage.html">
<INPUT TYPE=hidden NAME=ui_return_to VALUE="item_id=sessions">
<INPUT TYPE=file NAME=newfile>
<INPUT type=hidden NAME=upload_fn VALUE="upload/">
<INPUT NAME=ui_upload_ascii TYPE=radio VALUE=1> ASCII<BR>
<INPUT NAME=ui_upload_ascii TYPE=radio VALUE=0 CHECKED> Binary
<INPUT TYPE=submit name="mv_click" VALUE="Upload">
</FORM>
In the target page (test.html):
[set name=upload_filename interpolate=1][calc]
$filename = $CGI->{newfile} ;
$filename =~ s|.*[\\/]||;
$filename
[/calc][/set]
[value-extended
Yes=1
No=0
name=newfile
outfile="upload/[scratch upload_filename]"
ascii="[value ui_upload_ascii]"
]
[bounce href="[return-to url]"]
That's it!
Good luck.
Zack
mail archive keywords: file upload
----- Original Message -----
From: "Jason Kohles" <email@jasonkohles.com>
To: <interchange-users@lists.akopia.com>
Cc: "office.standardprinting.net" <zack@office.standardprinting.net>
Sent: Tuesday, March 13, 2001 9:50 AM
Subject: Re: [ic] s/Reg Exps on file paths/headaches/g ;
> On Tue, Mar 13, 2001 at 09:44:41AM -0500, office.standardprinting.net
wrote:
> > I'm working on an upload page, and found the docs on using
[value-extended],
> > etc. So far, so good.
> >
> > But the <input type="file" . . . > tag returns a full path from Win
clients,
> > e.g.: F:\folder\file.jpg (Macs dutifully return only the filename, not
the
> > whole path :)
> >
> > $filename =~ s|.*[\\]{1}|| ;
> >
> All you really need here is:
>
> $filename =~ s|.*\\||;
>
> to get rid of everything up to and including the last backslash. You
might
> want to include forward slashes as well, as most unix browsers also return
> the full path. This should do the trick:
>
> $filename =~ s|.*[\\/]||;
>
> --
> Jason S Kohles
> jason@jasonkohles.com
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
>
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users