Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASPUpload, trying to get file name after upload

Posted on 2004-08-25
7
Medium Priority
?
424 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
Technology Partners: 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!

 

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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

597 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