Solved

ASPUpload, trying to get file name after upload

Posted on 2004-08-25
7
406 Views
Last Modified: 2008-02-26
Hi, I am trying to get the name of the name of the file that ASPUpload just uploaded and set it to a variable to be used elsewhere in the page.  I've read material in ASPUpload site and also here: http://www.asp101.com/resources/aspupload.asp

 Set myfile = Upload.Files("FILE1") should work, but it doesn't. Here's my code right now:


      Set Upload = Server.CreateObject("Persits.Upload.1")

      Upload.OverwriteFiles = False
      On Error Resume Next

      Upload.SetMaxSize 1048576      ' Limit files to 1MB
      Count = Upload.Save("\\premfs14\sites\premium14\aasg\webroot\aura\images\faculty")

Set myfile = Upload.Files("FILE1")
0
Comment
Question by:polaatx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:darksinclair
ID: 11896971
does Set Item1 = Upload.Form("FILE1")  work?
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 11896987
what do you get when u run the following examples off the site?

<%  
Set Upload = Server.CreateObject("Persits.Upload.1")  
Upload.Save "c:\upload"
%>  
Files:<BR>  
<%  
For Each File in Upload.Files  
Response.Write File.Name & "=" & File.Path & " (" & File.Size & ")<BR>"
Next
%>  
<P>  
Other items:<BR>  
<%  
For Each Item in Upload.Form  
Response.Write Item.Name & "=" & Item.Value & "<BR>"
Next
%>  

Cheers,
0
 

Author Comment

by:polaatx
ID: 11897061
Set Item1 = Upload.Form("FILE1") doesn't work.

The code you site above runs fine. I do get everything printed out correctly. The problem is that File.Name works only after it appears "For Each File in Upload.Files"

I need to get the File.Name way before it gets to html because I need to attach the file to an email.

0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:polaatx
ID: 11898963
Gosh, I am still working on this. I've read much of the aspUpload's manual and from all I can tell this should work:

      Set Upload = Server.CreateObject("Persits.Upload.1")

      Upload.OverwriteFiles = False
      On Error Resume Next

      Upload.SetMaxSize 1048576      ' Limit files to 1MB
      Count = Upload.Save("\\premfs14\sites\premium14\aasg\webroot\aura\images\faculty")

                 Set Item1 = Upload.Files("FILE1")

But when I put  File Name = <%=Item1%> in the html, I get nothing. The photo uploads, but I don't get the damn file name. So I can't attach it to an email. It's driving me nuts!

Any help would be much appreciated.

0
 
LVL 5

Accepted Solution

by:
darksinclair earned 500 total points
ID: 11902287
wouldn't from their example you need File Name = <%=Item1.Name%> ? as you are making Item1 a File Object?

-> their example seems horrible, I looked at it but I didnt' like it.
0
 

Author Comment

by:polaatx
ID: 11908138
I agree. Many of their examples are really confusing. They actually answer their email though.
I heard back and this is how to do it:

<%
      Set Upload = Server.CreateObject("Persits.Upload.1")

      Upload.Save ("\\premfs14\sites\premium14\aasg\webroot\aura\images\faculty\")

'Set item1 = Upload.Files(1)  %>

item1 then becomes the variable that contains the file name.
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 11908896
well Im glad atleast they support their customers.  Glad you were able to get this figured out dude and thanks for the points.

Take care and happy coding

Cheers,
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question