upload a file via a form using ASP

試著忘記壹切 提交于 2019-12-12 03:08:37

问题


I have a simple html form in a .asp page. I would like add a field to let users upload files via the form on my server/ftp on the fly. Any suggestions on how I can do this please?

this is the code I am using for the HTML

<form name="formUpload" id="formUpload" method="post" enctype="multipart/form-data" action="">
<table valign="top" align="left" bgcolor="PaleGoldenRod" width="300px" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="PaleGoldenRod" valign="top">
    <td width="300px">
        <input type="file" size="50" name="file1">
        <input type="submit" name="submit" value="Upload File">
    </td>
</tr></table></form>

I have no idea how to do this because I never had done something like this.


回答1:


You could try the following jQuery plugin to handle 'on the fly' uploads:

jQuery File Upload

But like Symeon said, you will need an ASP Classic component that will handle the file uploads on the server. I used the FreeASPUpload version a couple of times, works like a breeze.




回答2:


In ASP you have to write your own upload handler to take the http stream and write it to disk - there is plenty of example code on the web. I have some, but it is a bit big to post here.

Look at this or this

HTH



来源:https://stackoverflow.com/questions/10008556/upload-a-file-via-a-form-using-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!