问题
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