1

I`m pretty much new to ASP, and this code was here before me. I really do need assistance. I tried to get a more verbose error but I have not been able to do so.

I get this error when I try loading an image to the server:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

Here is the code snippet:

HTML

<form action="upload_vehicle.asp" method="post" enctype="multipart/form-data">
    <input type="file" name="file1"><br />
    <input type="hidden" name="vID" value="<%=vID%>">
    <input type="submit" value="UPLOAD PHOTO"><br /><br />
</form>

Inside upload_vehicle.asp

Set Upload = Server.CreateObject("Persits.Upload")
 Upload.OverwriteFiles = False ' Generate unique names
'For Large Photos
Server.ScriptTimeout = 60000
filepath= "c:/www/harteauto/img/Vehicles/upload/"  'Upload area for photos
Upload.Save filepath
'Response.Write("HERE2")
'Response.End
For Each File in Upload.Files
    uphoto= File.ExtractFileName
next
Response.Write("HERE")
Response.End

I get output before the for loop, but once I get to it, it fails horribly! I found this info in the log of the IIS Server

LIST - 226 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c /harteauto/Admin/inc
TYPE I 200 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c -
TYPE A 200 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c -
SIZE upload_vehicle.asp 213 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c /harteauto/Admin/inc/upload_vehicle.asp
MDTM upload_vehicle.asp 213 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c /harteauto/Admin/inc/upload_vehicle.asp
PORT 174,116,115,42,207,82 200 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c -
DataChannelOpened - - 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c -
DataChannelClosed - - 0 0 4cad67e1-3215-4611-bb36-2570a5ed459c -

I compared privileges to another project and could NOT see anything that was different. Please help me!!

UPDATE Retrieved a more detailed error code using FF.

CTRL + ALT + K opens console in FF

A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element.

TO DO - DID NOT WORK Attempt this solution

UPDATE 2 - The SOLUTION

Enable ASP to return Error Messaging. This displayed a much more verbose error stating the path on the server was incorrect. Issue persisted since there were other paths that required to be fixed. Unsure why this was the cause but I suspect it affects other projects as well.

Community
  • 1
  • 1
mcv
  • 1,380
  • 3
  • 16
  • 41
  • Can you enable detailed error messages (in browser and/or web server) so you can see what the error is? Usual errors for uploading are no write permissions to upload folder, or file size exceeds web server limit (try uploading a very small file). – johna Jul 15 '15 at 22:16
  • I was trying to get this done in Chrome, but I could not resolve it, just got it in FF and I think I found a solution. I will modify the post with more information. – mcv Jul 16 '15 at 00:38
  • 3
    I'm not sure that is the problem. It would be helpful to see the server side error rather than this client error. Have you enabled detailed server errors? See this SO post for possible ways to do it, either in IIS or in web.config: http://stackoverflow.com/questions/2640526/detailed-500-error-message-asp-iis-7-5 – johna Jul 16 '15 at 02:05
  • From : http://www.aspupload.com/object_file.html#ExtractFileName the method `ExtractFileName` is obsolete. Try using `FileName` instead – Flakes Jul 16 '15 at 06:25
  • @John Thank you. I turned on ASP error messages and that resolved my issue right away. Apparently the pathways to save the images was incorrectly configured. I noted that so I changed it, yet there were two more pathways that caused the error to persist. – mcv Jul 16 '15 at 10:11
  • Many times you do not want to expose the actual error messages to the public. So in our environment we turn off messages to the public and any time we get a generic 500 error type issue, we remote in to the server directly and access the site on the server. The server then considers it a local machine and will allow you to see the error without modifying your IIS settings to expose the error to the public. – Gary Richter Jul 16 '15 at 14:01
  • Yeah I did attempt that, but the message on IE from the server was the same, I believe. I also reverted that setting once I fixed the issue. :) – mcv Jul 16 '15 at 14:04
  • @GaryRichter, I agree... I have a custom 500 error page that emails any errors and/or logs them depending on the application. – johna Jul 16 '15 at 22:16
  • @John Sounds like a good move that needs to be made. Could you point me to a good resource or tutorial to do this for using Classic ASP?! – mcv Aug 06 '15 at 11:42

0 Answers0