Solved

file upload without using fileUpload control

Posted on 2006-12-01
7
448 Views
Last Modified: 2008-02-01
I want to give drag drop and upload functionality in my web page.
I have achieved the drag and drop part. Now I have file names in a text box and I want to upload all files listed in the text box without the help of fileUpload control.

Is there any way to read client files into binary streams. I tried to use file:\\\c:\temp\abc.jpg but it reads from the server only.
0
Comment
Question by:param4r
7 Comments
 
LVL 12

Expert Comment

by:AmigoJack
ID: 18053174
this is considered hazardous and thus not supported by browsers. think of a website which has javascript code that auto-fills (for example) "C:\autoexec.bat" into the upload-control and then automatically submits the form?

believe me, its better the way its now :) if using uploads via http, the user HAS to use the file-upload controls manually
0
 

Author Comment

by:param4r
ID: 18053218
Thanx AmigoJack,

I understand the limitation.

Is it possible to read data into binary stream from my image control.
0
 
LVL 6

Accepted Solution

by:
nbkbar7 earned 500 total points
ID: 18053227

AmigoJack is correct. I user interaction is accaptable as in a message confirming that the user wants to allow it you could use this solution...

http://www.experts-exchange.com/Web/Web_Languages/Q_20639591.html?query=javascript+file+upload&clearTAFilter=true
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Expert Comment

by:AmigoJack
ID: 18053303
"into binary stream from my image control"... i dont understand this. with javascript you can change the source of an image of an <image> tag, yes. the upload-functionality doesnt care about images, archives or else...
0
 

Author Comment

by:param4r
ID: 18053373
thanx nkkbar7,

I think solution provided in the url will work for me.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 18053396
you can write a javascript function (invoked from a button of your choice) which gets the filename from your select box, inserts it in a input tage of type=file, and then submits the form around that input tag (which has to be enctype=multipart/form-data, for obvious reason). You even can have multiple such input tags in that form and so submitt all files at once.
0
 

Author Comment

by:param4r
ID: 18059114
Dear nkkbar7,

The solution provided by you in the url seems to be perfect for my requirement.
But sadly I am not able to use it, my code stops at the line where adodb.stream is trying to load the file from my hard disk

BinaryStream.LoadFromFile("d:\\temp\namrata.jpg");  

the above line is not being executed successfully, can you put some light.

I think if this is sorted out remaing code will not give any problem.

Thanx


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 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

21 Experts available now in Live!

Get 1:1 Help Now