Hi! I'm using SoftArtisans FileUP to upload ASP files and have a problem which is driving me nuts. I have a form in which users enter a bunch of data and then can choose up either upload a file or enter data in a TEXTAREA field. My action page needs to check whether a file name was entered in the file field: <input type="file" name="f1">. If so, then I want to upload the file to a specific directory, get the filename and store the filename in the database. If they just fill out the textarea, then just store that in the database and nothing is uploaded.
If I check if the file is not there, it does not upload although no error is generated. I have a small script which shows the problem:
NOW, the action:
If I remove the check for isEmpty, the file is uploaded to my directory o.k. When I leave it in, it appears to upload, gives number of bytes, and no error message, but the file is not in the directory. I've searched asp.net and softartisans knowledge base to no avail.
Any ideas? Thanks in advance.
If I check if the file is not there, it does not upload although no error is generated. I have a small script which shows the problem:
Code:
<HTML>
<HEAD>
<TITLE>Please Upload Your File</TITLE>
</HEAD>
<BODY>
<form enctype="multipart/form-data" method="post" action="simple2.asp">
Enter filename to upload: <input type="file" name="f1"><br>
<input type="submit">
</form>
</BODY>
</HTML>
NOW, the action:
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Upload File Results</TITLE>
</HEAD>
<BODY>
<% Set upl = Server.CreateObject("SoftArtisans.FileUp") %>
<%
if upl.isEmpty = 1 then
Response.write("nothing to upload")
strFilename=""
else
upl.path = "e:\mydir"
upl.form("f1").Save
strFilename=upl.form("f1")
'Get original name of file to store in database
set fs=Server.CreateObject("Scripting.FileSystemObject")
strNominationFile=fs.getfilename(strfilename)
response.write("filename = " & strNominationFile & "<br>")
set fs=nothing
%><BR>
Total Bytes Written: <%=upl.TotalBytes%>
<%end if
%> </BODY>
</HTML>
If I remove the check for isEmpty, the file is uploaded to my directory o.k. When I leave it in, it appears to upload, gives number of bytes, and no error message, but the file is not in the directory. I've searched asp.net and softartisans knowledge base to no avail.
Any ideas? Thanks in advance.