Date:  09/08/2003 11:15:17 PM Msg ID:  001614
From:  FoxWeb Support Thread:  001602
Subject:  Re: Uploading Files
I tried your script on a couple of different test servers with no problems.  I did not test the part that writes the file to a table, but the files written to the upload directory are identical to the ones sent by the browser.  I tried all sorts of file types, including PDF, BMP, DOC and FWX.

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Goldsmith on 09/04/2003 09:28:26 PM:
Sure thing, thanks for asking. Here is the whole thing. IT seems to not upload some file types such as PDF or even FWX. At times it even fails on DOC or GIF/JPG. What I would like to have is a routine that uploads any file type. Perhaps this does and I just have an error but I tried to be faithful in recreating the example upload.fwx in this code. Any thoughts or ideas would be appreciated.
 
*** BEGIN SOURCE ***
<%
LOCAL UPLOADNAME, UPLOADFILE, UPLOADTITLE, WHOLENAME, UPFILE
M.UPLOADNAME = ""
M.UPLOADFILE = ""
M.UPLOADTITLE = ""
M.WHOLENAME = ""
M.UPFILE = ""
%>
 
<%
IF Request.FormCount("btnchoice") > 0
   M.UPLOADFILE = ALLTRIM(Request.Form('UPLOADFILE'))
   M.UPLOADTITLE = ALLTRIM(Request.Form('UPLOADTITLE'))
  
   *** SEND IT ***
   FieldObject = Request.FormFieldObject("UPLOADFILE")
   IF FieldObject.ContentLength > 0
      FilePath = "..\upload\" + FieldObject.FileName
      STRTOFILE(FieldObject.Value(), FilePath)
   ENDIF
 
   *** Get path and file name for storage  ***
   lcLen = LEN(filepath)
   lcright = RIGHT(filepath,lclen-10)
   lcfilepath = "upload/"+lcright
 
   *** Open It  ***
   IF !USED('notesmenu')
      USE ../data/pbs!notesmenu SHARED IN 0
   ENDIF
   SELECT notesmenu
 
   *** Store it  ***
   APPEND BLANK
   lcID = idgenerate()    && Generate a unique ID
   REPLACE NID WITH lcID
   REPLACE NTITLE WITH M.UPLOADTITLE
   REPLACE NURL WITH lcfilepath
   USE       
   Response.Redirect("materials.fwx")
ENDIF
%>   
<html>
<head>
<title></title>
</head>
<BODY TOPMARGIN="0" LEFTMARGIN="0" BGCOLOR="#D1E5F3">
<TABLE>
   <TR>
      <TD>
         <form action="iUpload.fwx" method="post" enctype="multipart/form-data">
            <TABLE>
              <TR>
                 <TD ALIGN="Left" VALIGN="TOP"><B>Title</B></TD>
                 <TD>
                    <INPUT TYPE=text NAME="UPLOADTITLE" SIZE=80 MAXLENGTH=100 VALUE="<%=(M.UPLOADTITLE)%>">
                 </TD>
             </TR>
             <TR>
                <TD ALIGN="Left" VALIGN="TOP"><B>File to upload</B></TD>
                <TD>
                   <INPUT TYPE=file NAME="UPLOADFILE" SIZE=70 MAXLENGTH=100 VALUE="<%=(M.UPLOADFILE)%>">
                </TD>
             </TR>
                <TD ALIGN="Left" VALIGN="TOP"><B>Choose</B></TD>
                <TD>
                    <INPUT TYPE="SUBMIT" NAME=btnchoice VALUE="Upload">
                </TD>
              </TR>
           </TABLE>
        </FORM>
      </TD>
   </TR>
</TABLE>
</BODY>
</HTML>
 
*** END OF SOURCE ***
 
Sent by FoxWeb Support on 09/04/2003 04:59:03 PM:
The upload.fwx script and the techniques employed by it have been utilized in many applications with no known issues.  Please provide additional details on the nature of the problem.

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Goldsmith on 09/03/2003 08:45:34 AM:
Hello. I was using the upload.fwx example to upload files but realized that some files, such as .zip, was not uploading. IS there a way to upload any type of file?
 
JOe