Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Asp upload file

Hi experts, I'm trying to upload files base on the codes below but I'm having trouble with files.asp when executing the code an error says; The page cannot be displayed because an internal server error... I'm using Windows 10 OS and I don't know what Server.CreateObject should I use if this is the cause of an error. Please help!

Html

<html>
<head>
<title>Uploading a file and saving to disk</title>
</head>

<body>
<h3>File Upload</h3>
<form method=post action="filesave.asp" enctype=multipart/form-data>
<input type=file name=filesent><br>
<input type="submit" value="Send File">
</form>
<p><a href=view.asp>View files already uploaded</a></p>
</body>
</html>

Open in new window

Asp server side

<%@ language=vbscript %>
<%

  'Use one of the following lines, depending on the version of csASPUpload
  'Set Upload = Server.CreateObject("csASPUpload32.Process")
  'Set Upload = Server.CreateObject("csASPUpload32Trial.Process")
  Set Upload = Server.CreateObject("csASPUpload64.Process")
  'Set Upload = Server.CreateObject("csASPUpload64Trial.Process")

  'For the earlier version of csASPUpload:
  'Set Upload = Server.CreateObject("csASPUpload.Process")
  'Set Upload = Server.CreateObject("csASPUploadTrial.Process")

%>
<html>
<head>
<title>Saving file</title>

</head>

<body>
<%
  'Read the upload
  Upload.Read

  'Check there is a file before trying to save it

  If Upload.FileQty > 0 Then

   Upload.FileSave Server.MapPath("./files/") & "\" &  Upload.FileName(0), 0

%>
   <p>The file has been stored</p>
   <p><a href=fileupload.htm>Upload</a> another file.</p>
   <p><a href=view.asp>View</a> files already uploaded.</p>
<%
  Else
%>
   <p>No file was received</p>
   <p><a href=fileupload.htm>Upload</a> another file.</p>
   <p><a href=view.asp>View</a> files already uploaded.</p>
<%
  End If
%>
</body>
</html>

Open in new window

Avatar of HainKurt
HainKurt
Flag of Canada image

did you install this component?

csASPUpload64

csASPUpload Version 3.1 - Online Manual
http://www.chestysoft.com/upload/manual.htm
the main part that you need to do is:

Before the component can be used the DLL file must be registered on the server. This can be done using the command line tool REGSVR32.EXE. Take care to use the correct version of this tool as there is a 64 bit version in the Windows\System32 folder and a 32 bit version in the Windows\SysWOW64 folder. The syntax is:

regsvr32 dllname

where dllname is the path and name of the DLL to register.
There will be two DLL files supplied in the zip archive. One is for 32 bit systems and the other is for 64 bit. The 32 bit file is called csASPUpload32.dll (csASPUpload32Trial.dll for the trial version). The 64 bit file is called csASPUpload64.dll (csASPUpload64Trial.dll for the trial version). The 64 bit file cannot be used on 32 bit systems.
Avatar of Whing Dela Cruz

ASKER

Hi Hainkurt, I installed it already but still not running. Do you have any other solution uploading files to the server side Asp? Thanks!
are you looking for a free tool?

below is another one used a lot, but not free

Persits.Upload
http://www.aspupload.com/manual_simple.html
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Hainkurt, I will try to re-install the dll right now. I think the problem is on the registering the dll which was not properly done. I will feedback you later. Thanks a lot Hainkurt for your time..
Hello HainKurt, I was able to registered the dll successfully. However, when I tried to send the file to the server an error says; "You do not have permission to view this directory or page" can you guide which part of the codes should I set the privilege  to view and enable the client  to download? Thanks!
i need to see your asp code first... may not be related to permission...
Hello HainKurt, this is my Asp server side

%>
<html>
<head>
<title>Saving file</title>

</head>

<body>
<%
  'Read the upload
  Upload.Read

  'Check there is a file before trying to save it

  If Upload.FileQty > 0 Then

   Upload.FileSave Server.MapPath("./files/") & "\" &  Upload.FileName(0), 0

%>
   <p>The file has been stored</p>
   <p><a href=fileupload.htm>Upload</a> another file.</p>
   <p><a href=view.asp>View</a> files already uploaded.</p>
<%
  Else
%>
   <p>No file was received</p>
   <p><a href=fileupload.htm>Upload</a> another file.</p>
   <p><a href=view.asp>View</a> files already uploaded.</p>
<%
  End If
%>
</body>
</html>

Open in new window

I guess you figured out and it is working fine now with your component...
above issue looks like your web site is not configured for anonymous authentication...
you should check your web site in IIS