Solved

ASPUpload, trying to get file name after upload

Posted on 2004-08-25
7
399 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 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pass through dll 2 99
jquery to restrict certain words from input in form 11 47
Get hold of longitude and latitude in iframe string 11 52
href return to normal window 5 31
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…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

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