Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2004, 06:16 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp uploading script


Hi,

I have integrated a free asp uploading script to my website. It works in similar way as any other uploading script (Click browse button, Select file from window, click upload button and it will upload your file onto web server).



What I want is, when I click on browse button and window is open to select a file. The files that show in that window should only be of "swf" extension. Means it should only show a particular type of file not all of the files.


Any idea..
Any help... will really be appriciated.


Thanks
Zeeshan Ahmed


 
Old October 2nd, 2004, 07:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Zeeshan Ahmed,

I read about using ACCEPT attribute for restricting contenttypes. It all said you should set enctype="multipart/form-data" in <form> tag and use ACCEPT attribute of FILE control to restrict the type of files to be uploaded. But I have not found any example supporting that yet. Common content types used with ACCEPT atribute are - text/html, image/jpeg, model/vrml, video/quicktime, application/java, text/css, and text/javascript.

After a lot of search on that, have never got through successfully yet, instead used client -side scripting to restrict that as some sites recommended.

You can try this example to see how that works.
Code:
<script type="text/javascript" language="JavaScript">
function check() {
  var ext = document.f.pic.value;
  ext = ext.substring(ext.length-3,ext.length);
  ext = ext.toLowerCase();
  if(ext != 'jpg') {
    alert('You selected a .'+ext+
          ' file; please select a .jpg file instead!');
    return false; }
  else
    return true; }
</script>

<form method="post" name=f enctype="multipart/form-data" onsubmit="return check();" action="">
<p>
Please select a JPEG (.jpg) file to be sent:
<br>
<input type="file" name="pic" size="40" accept="image/jpeg">
<p>
Please include a short explanation:<br>
<textarea name="expl" rows="3" cols="40" onfocus="check();">
</textarea>
<p>
<input type="submit" value="Send">
</form>
Can try that modifed for SWF.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
File Uploading Script Problems mercury7 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 13 January 8th, 2009 09:13 AM
Uploading a file with ASP BananaJim Classic ASP Professional 1 December 7th, 2006 06:57 PM
asp uploading script zeeshandar Classic ASP Components 3 November 13th, 2004 08:48 PM
Uploading files with ASP Varg_88 Classic ASP Basics 1 September 10th, 2004 08:30 AM
Uploading asp files robbo Classic ASP Basics 2 January 19th, 2004 03:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.