File Upload Control with Java Script [Resolved]

Posted by Nismeh under JavaScript on 9/6/2013 | Points: 10 | Views : 6415 | Status : [Member] | Replies : 15
Hi I want to Upload File. As common problem I am facing issue with 'c:\FakePath\. .' Can anyone suggest resolution on this. Because document.getElementById("fname").value only gives me 'c:\FakePath\. .' but I am interested in actual Path. Please provide suggestion ASAP as I am working on client's immediate requirement.

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It



Responses

Posted by: Allemahesh on: 9/6/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
The alternate way is to use Async file upload with jquery.
You can see the below links:

http://weblogs.asp.net/jalpeshpvadgama/archive/2011/12/23/async-file-upload-with-jquery-and-asp-net.aspx
http://www.aspsnippets.com/Articles/Asynchronous-File-Upload-with-jQuery-Uploadify-in-ASPNet.aspx

If it helps you or directs U towards the solution, MARK IT AS ANSWER

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 9/6/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Dear Nismeh,

This is good questions. But, Modern browsers do not give this information since it is considered insecure. Browsers never reveal the original path of the file from the client side. So all you might get is: C:\fakepath\ + your file name

If it helps you or directs U towards the solution, MARK IT AS ANSWER

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/6/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
file upload path will differ depends on browsers
http://forums.asp.net/p/1894620/5349197.aspx?importing+a+file+with+javascript
http://msdn.microsoft.com/en-us/library/aa479405.aspx

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Allemahesh,

You are right at your point. Even I found same reason for this. But actually I am trying to upload file. So can you suggest me on that? What can be another way ?

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
Its true, we can't upload file through javascript straightaway due to security reasons.
(Javascript[i.e. Browser] can't access any file).

If we look at JQuery, we got plugins to Upload files.

Go to "http://plugins.jquery.com/" and put Upload in Search-Box.

Check out below link:
http://plugins.jquery.com/blueimp-file-upload/

http://hashtagakash.wordpress.com/

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Bandi,

Thank you for your response. But I want these thing to be done on JavaScript. As I am using ExtJS. So Can you please suggest me solution for JavaScript and if you can provide solution on ExtJS than it will be more impressive.

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/6/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link for ExtJS File Upload:
http://dev.sencha.com/deploy/ext-4.0.0/examples/form/file-upload.html

NOTE: You do not need full file path from the client browser since it will have nothing to do with the uploaded destination on the server. Many browsers restrict full local path availability due to security concerns. IE will show full path if you add site to "Trusted Sites", but again there is no need for that.

Refer this link for the similar problem
http://www.sencha.com/forum/showthread.php?267159

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
H Bandi

I've already worked with that Sencha link, but it wasn't much useful.

Ya if I am not with the Full Path can you suggest me that how can I go further with the path?

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/6/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
For what purpose you wish to get file path? Can you explain us the requirement... Someone can provide you other direction

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
In my application I want to upload files on server side. My application is based on ExtJS. I am selecting one file with fileuploadfield. Now I want that file to be uploaded at server side.

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/6/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this one...
http://stackoverflow.com/questions/2514937/file-upload-using-ext-js
http://loianegroner.com/2010/03/ajax-file-upload-with-extjs-and-spring-framework/

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/6/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Allemahesh,

Given link is much useful. Now I think I can go ahead with that work by having research on it. Thanks :)

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/9/2013 [Member] Starter | Points: 25

Up
0
Down
Hey Allemahesh,

Done with your suggestion. :) Thanks again

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/9/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
can you post the solution which was helps you.. it will be helpful to others

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/9/2013 [Member] Starter | Points: 25

Up
0
Down
Plz Check attachment.
Its with an demo. Which I've added to my project by lill modification
 Download source file

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response