Solved

How to do an AJAX file upload in ASP?

Posted on 2011-09-16
6
314 Views
Last Modified: 2012-05-12
Hi Experts,
I've always coded file uploads using FreeAspUpload in a separate popup window, but would like to explore using Ajax instead.

Is this even possible? I've seen ajax upload tools but they're all ASP.NET and I'm looking for just pure ASP.

I've versed in Ajax and JQuery.
0
Comment
Question by:rascal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36552703
do you have the server side code?
0
 
LVL 1

Author Comment

by:rascal
ID: 36552710
Yes, I have the server side ASP code - it is FreeAspUpload. (see attached and rename to .asp) freeASPUpload.txt
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36552734
OK, your answers are here, click on the examples and on the File uploads tab : http://jquery.malsup.com/form/#file-upload

so basically to post a form using the plugin, here a basic page  :
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
         $('#uploadForm').ajaxForm({ "success": function() { alert("file successfully uploaded !"); } });
    });
</script>
</head>
<body>
<form id="uploadForm" action="files.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Submit">
</form>
</body>
</html>

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:rascal
ID: 36552743
Thanks, but your solution is PHP based (see the action=files.php in your example) which our web server doesn't support. We need a completely 100% ASP solution.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36552748
You said you've the server side code. Don't be afraid by an extension (file.php)
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
         $('#uploadForm').ajaxForm({ "success": function() { alert("file successfully uploaded !"); } });
    });
</script>
</head>
<body>
<form id="uploadForm" action="files.asp" method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Submit">
</form>
</body>
</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:rascal
ID: 36552777
Great, thanks leakim!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Today I am discussing AJAX problems in IE7 and I bet this will helps many guys out here who have problems with AJAX work. Lets start with the discovery of problem and then we will talk about its different solutions. My last two projects included …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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