?
Solved

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

Posted on 2011-10-05
4
Medium Priority
?
993 Views
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.
0
Comment
Question by:GHR_GDL
4 Comments
 
LVL 10

Accepted Solution

by:
P1ST0LPETE earned 1000 total points
ID: 36922181
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.
0
 
LVL 14

Expert Comment

by:dejaanbu
ID: 36922693
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
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 36923200
the following link might guide you to achieve what you need
http://www.codeproject.com/KB/aspnet/fileupload.aspx

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
0
 

Author Closing Comment

by:GHR_GDL
ID: 36927956
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.
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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline
Suggested Courses

864 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