Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / January 2007



Tip: Looking for answers? Try searching our database.

File upload problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PW - 05 Jan 2007 11:01 GMT
I'm writing a small system to allow users to upload documents to my server.
I'm using Persist AspUpload for this.  I have 2 ASP files.

In the first ASP file I prompt the user for a file description and a
filename, like this ...

<FORM METHOD="POST" ACTION="sl_upload2.asp" ENCTYPE="multipart/form-data">
  <TABLE>
     <tr><td>Document description</td><td><INPUT TYPE="TEXT" NAME="DOCDESC"
SIZE="100"></td></tr>
     <tr><td>Document filename   </td><td><INPUT TYPE="FILE" NAME="DOCFILE"
SIZE="100"></td></tr>
  </table>
  <p>
  <button type="submit" style="width:100px;height:25px;">Ok</button>
  <button type="reset"  style="width:100px;height:25px;">Clear</button>
</FORM>

In the 2nd ASP, which is the - ACTION="sl_upload2.asp" - file, I simply
perform the upload, like this ...

<%
Response.Write "<html>"
Response.Write "<head><title>St Lukes After School Care</title></head>"
Response.Write "<body bgcolor=" & Session("system_color_bg") & ">"

Set Upload = Server.CreateObject("Persits.Upload")
intCount = Upload.Save("C:/INETPUB/WWWROOT/SLASC/UPLOADS")

Response.Write "The file(s) have been stored successfully."
Response.Write "</BODY>"
Response.Write "</HTML>"
%>

No matter what I try (Get/Post/etc) I cannot get the DOCDESC and DOCFILE
values to pass through to the 2nd ASP file.

What can I do ?

Thanks,
PW
Tim Slattery - 05 Jan 2007 13:37 GMT
><%
>Response.Write "<html>"
[quoted text clipped - 11 lines]
>No matter what I try (Get/Post/etc) I cannot get the DOCDESC and DOCFILE
>values to pass through to the 2nd ASP file.

They won't be in the Form collection or the Request collection, where
you would otherwise expect to find them, because you've specified
ENCTYPE="multipart/form-data", as you must to upload the file.

DOCDESC and DOCFILE will be sent along with the file in a
MIME-formatted data stream. I don't know anything about Persits
Upload, but it should have some way to let you access these things.

Signature

Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
http://members.cox.net/slatteryt

9ntw9 - 05 Jan 2007 14:32 GMT
Set objUpload = Server.CreateObject("Persits.Upload")

For Each Item in objUpload.Form
        ...............
Next

> ><%
> >Response.Write "<html>"
[quoted text clipped - 25 lines]
> Slattery_T@bls.gov
> http://members.cox.net/slatteryt
PW - 05 Jan 2007 21:48 GMT
I have added some lines to the program to display the values I want.
DOCDESC is now coming through, but not DOCFILE.

<%
Response.Write "<html>"
Response.Write "<head><title>St Lukes After School Care</title></head>"
Response.Write "<body bgcolor=" & Session("system_color_bg") & ">"

Set Upload = Server.CreateObject("Persits.Upload")
intCount = Upload.Save("C:/INETPUB/WWWROOT/SLASC/UPLOADS")

Response.Write "The file(s) have been stored successfully."

myDOCDESC = Upload.Form("DOCDESC")
myDOCFILE = Upload.Form("DOCFILE")

Response.Write myDOCDESC
Response.Write myDOCFILE

Response.Write "</BODY>"
Response.Write "</HTML>"
%>
PW - 06 Jan 2007 22:33 GMT
I've sorted it out now.  Thanks for your help everyone !  :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.