We have several solutions for file upload with witango. Some AJAX and progress bars and the like. But I tell you, this is one of the areas where php just amazed me. When you upload a file, here is an available aray caled $_files with all the info you need in it, its beautiful. Not to mention the yum installable ajax classes.

http://us.php.net/features.file-upload

--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

On Aug 30, 2007, at 11:00 AM, Rick Sanders wrote:

Hey Stefan,

This looks like a pretty slick and easy solution. Thanks!

Rick


From: Stefan Gonick [mailto:[EMAIL PROTECTED]
Sent: August 30, 2007 2:35 PM
To: [email protected]
Subject: Re: Witango-Talk: File name in File upload

There's a javascrip solution that I use all the time:

<SCRIPT LANGUAGE= "JavaScript" >
 <!-- Begin
 function ParseFilename()
{
   SplitThisStr = document.FORM_NAME.Filename.value;
   // create array from delimited string
   SplitArray = SplitThisStr.split("\\");
   // how many items in array
   LastIteminArray = SplitArray.length;
   // get the file name
   JustFilename = SplitArray[LastIteminArray-1];
   // set the hidden input value
   document.FORM_NAME.JustTheFilename.value = JustFilename;
}
//  End -->
</script>
<FORM name= "FORM_NAME" ENCTYPE= "multipart/form-data" METHOD=POST ACTION=" <@APPFILE> ?_function=upload" > <table border= "0" cellspacing= "0" cellpadding= "2" bgcolor= "#000000" >
<tr>
<td bgcolor=" @@ domain$mdt_Dark_Cell_Color" >
<table border=0 cellpadding= "2" width= "100%" bgcolor= "#FFFFFF" >
         <tr align= "center" valign= "middle" >
         <td bgcolor=" @@ domain$mdt_Dark_Cell_Color" height= "35">
&nbsp; <b><font color= "#FFFFFF" >Upload File </ font></b>&nbsp;
         </td>
         </tr>
         <tr align=CENTER valign=MIDDLE bgcolor=gainsboro >
         <td bgcolor=" @@ domain$mdt_Medium_Cell_Color" valign= "top">
<table border=0 cellpadding= "3" bgcolor= "#FFFFFF" >
                  <TR ALIGN= "LEFT" VALIGN= "middle" >
<TD bgcolor=" @@ domain $mdt_Light_Cell_Color" align= "right" >
                                    <b> File to Upload: </B>
                           </TD>

                           <TD>
<input type= "File" name= "Filename" value= "" size= "40" maxlength= "50" onChange= "ParseFilename()" >
                           </TD>
                  </TR>
                  </TABLE>
</TD></TR></TABLE>
</TD></TR></TABLE>
<p>
<input type= "hidden" name= "JustTheFilename" value= "">
<INPUT TYPE=SUBMIT VALUE="Upload File" style= "font-family: Verdana; font-size: 12"> <INPUT TYPE=RESET VALUE="Clear Form" style= "font-family: Verdana; font-size: 12">
</FORM>

The filename will be found in <@ARG JustTheFilename>.  Pretty cool.

Stefan


At 01:18 PM 8/30/2007, you wrote:

Hey William,

Well, unfortunately this looks like another job for Cold Fusion. The CF server automatically parses the filename and leaves the name and extension in-tact without having to do anything to the code. I would have preferred to use WiTango, but that’s too much code for an application that has a lot of file upload, and if there’s an error in the communication then the video wouldn’t get uploaded.

Kind regards,

Rick

From: William Conlon [ mailto:[EMAIL PROTECTED]
Sent: August 30, 2007 2:08 PM
To: [email protected]
Subject: Re: Witango-Talk: File name in File upload

Not exactly.

The complete path on the uploader's system is provided (kind of a security leak I think). path1 splits this into the directory hierarchy, with the filename as the last column. The filename then gets split into a name and extension.


On Aug 30, 2007, at 9:44 AM, Rick Sanders wrote:


Hey William,

Thanks! I take it that path1 would be the path to the file. Path2 would be the file name, and path3 would be the extension?

I thought it would be a little easier than this since I have many file uploads.

Kind regards,

Rick


From: William Conlon [mailto:[EMAIL PROTECTED]
Sent: August 30, 2007 11:36 AM
To: [email protected]
Subject: Re: Witango-Talk: File name in File upload

Your file upload button will look like this:

<input class="button" type="submit" name="Submit" value="Add File" onclick="this.form.path.value=this.form.File.value;" />

Then you can parse <@POSTARG NAME="Submit">. I pass the file and file path to a method for this:

<@ASSIGN SCOPE="method" name="size" VALUE="<@LENGTH STR='@@method $file'>">
<@IFEMPTY VALUE="@@method$filename">
<@ASSIGN SCOPE="method" NAME="path1" value="<@TOKENIZE VALUE='@@method$path' CHARS='\:/'>"> <@ASSIGN SCOPE="method" NAME="path2" value="@@method $path1[1,<@numcols array='@@method$path1'>]"> <@ASSIGN SCOPE="method" NAME="path3" value="<@TOKENIZE VALUE='@@method$path2' CHARS='.'>">
<@ELSE>
<@ASSIGN SCOPE="method" NAME="path3" value="<@TOKENIZE VALUE='@@method$filename' CHARS='.'>">
</@IF>
<@ASSIGN SCOPE="method" NAME="fileextn" value=".@@method$path3[1,2]">
<@ASSIGN SCOPE="method" NAME="filename" value="@@method$path3 [1,1].@@method$path3[1,2]">


On Aug 30, 2007, at 6:46 AM, Rick Sanders wrote:



Hey List,

Haven’t done this before in WiTango. When someone is uploading a file through a form, how can you grab the file name and extension? I can figure out how to check the file size, but I need to grab the file name and extension. Anyone else ever do this?

Thanks in advance!

<image001.jpg>

Rick Sanders
President
902-401-7689
www.webenergy.ca
www.webenergyusa.com

Shop online for computer systems, accessories, and much, much more! http://shop.webenergy.ca




______________________________________________________________________ __

TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf







______________________________________________________________________ __

TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf


______________________________________________________________________ __

TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf






______________________________________________________________________ __

TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf


______________________________________________________________________ __
TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf
=====================================================
Database WebWorks: Dynamic web sites through database integration
http://www.DatabaseWebWorks.com

CoachVille: For coaches and people taking teleclasses
http :// www.cvcommunity.com?af=69474


______________________________________________________________________ __
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
______________________________________________________________________ __
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf


________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to