Link to home
Start Free TrialLog in
Avatar of rascal
rascalFlag for United States of America

asked on

How to do an AJAX file upload in ASP?

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.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

do you have the server side code?
Avatar of rascal

ASKER

Yes, I have the server side ASP code - it is FreeAspUpload. (see attached and rename to .asp) freeASPUpload.txt
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

Avatar of rascal

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rascal

ASKER

Great, thanks leakim!