asp file upload error
Recently I struggled for file upload in asp web site. I did some fix but in beginning I am not able to understand the reason. After going through this below line, I am able to understand the reason
Q1. I want to let my users specify the destination directory to which the files will be uploaded. I included
A. You cannot use the Form collection before calling Save because it is not yet populated. The right way to do it is to upload the files to a temporary directory and then copy or move them to the specified destination directory as follows:
<%
n = Upload.Save "c:\upload"
For Each File in Upload.Files
File.Copy Upload.Form("Path") & "\" & File.ExtractFileName
Next
%>
I got hint from aspupload site.
www.aspupload.com/faq
Q1. I want to let my users specify the destination directory to which the files will be uploaded. I included
<INPUT TYPE="TEXT" NAME="PATH">in the form, and my upload script looks like this: <% n = Upload.Save(Upload.Form("Path")) %>. However this does not seem to work.
A. You cannot use the Form collection before calling Save because it is not yet populated. The right way to do it is to upload the files to a temporary directory and then copy or move them to the specified destination directory as follows:
<%
n = Upload.Save "c:\upload"
For Each File in Upload.Files
File.Copy Upload.Form("Path") & "\" & File.ExtractFileName
Next
%>
I got hint from aspupload site.
www.aspupload.com/faq
Comments
Post a Comment