Open File dialog to select files in ASP.NET with full path

Posted on 2011-10-05
Last Modified: 2012-06-27
Hi, I want to know if there is a way to select a file in ASP.NET that gives me not only the filename, but also the full path of the selected file; my intention is to use the full qualified path to add an attachment in a MailMessage object, which sends emails from the web page (pushing a button), to some clients emails addresses.
I don't want to upload the files to the server, but to use the web page to select a file, create with it an attachment in an email, and then send it to some address.
I tried to use the FileUpload object, but even if the full path is displayed, I can't access it in the code because some design restriction; I want to know how can I accomplish this easily.
Thanks in advance.
Question by:GHR_GDL
    LVL 10

    Accepted Solution

    As far as I know you have to upload the image to the server.  Javascript is very limited on how it can interact with the fileupload control.
    Ever user gmail, hotmail, yahoomail? All of them are web based email solutions, and in all of them if you attach a file to an email, you are basically uploading the image to the server first.

    Only way you might be able to do this is if you used ActiveX or a Java Applet; but these days those are considered pretty non-user friendly as they are so obtrusive.
    LVL 14

    Expert Comment

    you could use a third party control like uploadify for this task. u can get the full control of the file being uploaded..hence u can say "not to upload the file" and instead save the binary of the file as a session object.. (then u can get the file from the session while sending the email)..all these can be controlled using a handler file.

    hope this tip helps u
    LVL 26

    Expert Comment

    by:Anurag Thakur
    the following link might guide you to achieve what you need

    the link shows normal html controls but similar web control is also there but i was not able to find it
    If i find it I will post it here

    Author Closing Comment

    Your comment give the clue to understand the sequence of events that are fired when using the FileUpload control; indeed it's necessary to upload the file first to the server and then send it. The email sending process occurs in the SERVER, so the CLIENT file path I was trying to get is irrelevant; rather I need to know the file path of the file uploaded in the SERVER, and then create and send the attachment.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now