Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 11th, 2011, 01:30 AM
RK RK is offline
Registered User
Points: 38, Level: 1
Points: 38, Level: 1 Points: 38, Level: 1 Points: 38, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2008
Location: Jodhpur, Rajasthan, India.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to RK
Smile Upload an image to server using Javascript+Ajax

hi friends,
i am trying to do something new for my web page.
In this, i am going to upload an image from the user. Before uploading the images, the user can view selected image in a preview.
My Problem is that the mozila fiewfox is not show the complete path when i select an image using <input type="file"..../> tag.
After this, i want to upload this image to a specified folder at server using javascript and ajax.
I can do this using server side coding(C#.net) but I dont want to reload the complete page.
Can u one suggest me any thing.
Reply With Quote
  #2 (permalink)  
Old October 19th, 2011, 05:52 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it is not possible to process a file upload through the XMLHttpRequest object, becouse JavaScript has no access to your computer's file system. But, there are still ways to perform Ajax-like functionality for this task without making use of the XMLHttpRequest object.
This can be done via a hidden <iframe>
create a form and hidden iframe.
The JavaScript function uses the submit() event to sends form data to the iframe.
The PHP script uploads the image file on the server
This second JS function is used to display the image uploaded. It takes the address of the file loaded on the server and adds in a DIV (with "innerHTML") an <img> tag with the image uploaded.
hope it works..!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
AJAX AsyncFileUpload control - referencing server side controls after upload gorankovski ASP.NET 3.5 Basics 0 March 26th, 2010 04:32 AM
How to: Upload image to server and save image name in db with other form info Clint PHP How-To 1 October 26th, 2009 05:50 AM
Upload file using Ajax Dj Kat Ajax 5 February 3rd, 2008 11:46 PM
how to upload image into sql server database avnishraj23 General .NET 1 December 4th, 2007 02:20 PM



All times are GMT -4. The time now is 12:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.