Solved

Access Denied error when uploading image

Posted on 2008-10-26
2
1,389 Views
Last Modified: 2008-10-26
I'm trying to resize and upload an image using Persits ASPupload and ASPjpeg. The ASP upload portion of the script works fine but after I resize and try to upload it in ASPjpeg I get:

Persits.Jpeg.1 error '800a0001'
Access is denied.
/uploadtest/upload_jpeg.asp, line 111

This is line 111:       Jpg.Save (Server.MapPath("image\"))

Why does the image upload with ASPupload but not with ASPjpeg and how do I fix this?

There is my page: http://www.glowfishtw.com/uploadtest/pick_jpeg.asp

and here is my code:

<!-- Copyright (c) 2000 Persits Software, Inc.-->
<!-- For more information on AspJpeg, and to download your free eval version-->
<!-- visit http://www.aspupload.com -->

<HTML>
<HEAD>
<TITLE>JPEG Upload Script</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<%


      Set Upload = Server.CreateObject("Persits.Upload")
      Upload.OverwriteFiles = False
      Upload.SetMaxSize 5000000, True
      Upload.CodePage = 65001

      On Error Resume Next      
      Count = Upload.Save(Server.Mappath("image/"))


      If Err <> 0 or Count = 0 Then
            
%>

<FONT SIZE="3" FACE="Arial" COLOR="#FF0000"><% If Err <> 0 Then Response.Write "An error occurred:" & Err.Description Else Response.Write "Nothing has been uploaded."%></B></FONT>
<P>
<FONT SIZE="2" FACE="Arial"><A HREF="pick_jpeg.asp">Try again</A>.</FONT>

<%            
      Else
            On Error Goto 0
            Set File = Upload.Files(1)
            If File.ImageType = "UNKNOWN" Then
                  File.Delete
%>
<FONT SIZE="3" FACE="Arial" COLOR="#FF0000">This is not a valid image file.</B></FONT>
<P>
<FONT SIZE="3" FACE="Arial"><A HREF="pick_jpeg.asp">Try again</A>.</FONT>
<%            Else

                  ' Special handling of TIFF since AspUpload cannot extract TIFF dimensions
                  if File.ImageType = "TIF" Then
                        Set Tiff = Server.CreateObject("Persits.Jpeg")
                        Tiff.Open File.Path
                        ImageWidth = Tiff.OriginalWidth                        
                        ImageHeight = Tiff.OriginalHeight
                        Tiff.Close
                  Else
                        ImageWidth = File.ImageWidth
                        ImageHeight = File.ImageHeight
                  End if
%>

<FONT SIZE="2" FACE="Arial">
<B>The following <% = File.ImageType%> image has been uploaded:</B><P>
<TABLE CELLSPACING="0" CELLPADDING="2" BORDER="1">
      <TR><TD><FONT SIZE="2" FACE="Arial"><B>Path:</B></FONT></TD>
      <TD><FONT SIZE="2" FACE="Arial"><% = Server.HTMLEncode(File.OriginalPath) %></FONT></TD></TR>
      <TR><TD><FONT SIZE="2" FACE="Arial"><B>Size:</B></FONT></TD>
      <TD><FONT SIZE="2" FACE="Arial"><% = File.Size %> bytes</FONT></TD></TR>
      <TR><TD><FONT SIZE="2" FACE="Arial"><B>Dimensions:</B></FONT></TD>
      <TD><FONT SIZE="2" FACE="Arial"><% = ImageWidth %> x <% = ImageHeight %> pixels</FONT></TD></TR>
</TABLE>
<P>
<FORM ACTION="thumbnail.asp" METHOD="GET">
      <INPUT TYPE="HIDDEN" NAME="Path" VALUE="<% = Server.HtmlEncode(File.Path) %>">
      <INPUT TYPE="HIDDEN" NAME="Height" VALUE="<% = ImageHeight %>">
      <INPUT TYPE="HIDDEN" NAME="Width" VALUE="<% = ImageWidth %>">
      <INPUT TYPE="HIDDEN" NAME="scale" VALUE="50">
      <INPUT TYPE="HIDDEN" NAME="NewWidth" VALUE="100">
      <INPUT TYPE="HIDDEN" NAME="NewHeight" VALUE="100">
      <INPUT TYPE="HIDDEN" NAME="ResizeOption" VALUE="1">
      <INPUT TYPE="HIDDEN" NAME="Quality" VALUE="1">
      <INPUT TYPE="HIDDEN" NAME="Sharpen" VALUE="">
      <INPUT TYPE="HIDDEN" NAME="SharpenValue" VALUE="130">
      <INPUT TYPE="HIDDEN" NAME="Rotate" VALUE="0">
      <INPUT TYPE="SUBMIT" VALUE="Continue...">      
</FORM>
<P>
<IMG SRC="image/<% = Server.HtmlEncode(File.ExtractFileName) %>">
<P>
<FONT SIZE="2" FACE="Arial"><A HREF="pick_jpeg.asp">Upload another image</A></FONT>


</FONT>
<%

            End If
      End If
%>
<%
      ' create instance of AspJpeg
      Set jpg = Server.CreateObject("Persits.Jpeg")
      
      ' Compute path to source image
       Path = Server.HtmlEncode(File.Path)
      
       response.write (Path)
      
       'Open image
       jpg.Open(Server.HtmlEncode(File.Path))
      
       ' Set new width
      jpg.Width = 250
      jpg.Height = jpg.OriginalHeight * jpg.Width / jpg.OriginalWidth
      
      ' create thumbnail and save it to disk
      Jpg.Save (Server.MapPath("image\"))
        
      
%>


</BODY>
</HTML>



0
Comment
Question by:elliottbenzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Novarg earned 500 total points
ID: 22809821
Maybe it folders permissions?
Try to chmod folders with images to 777
0
 
LVL 4

Author Comment

by:elliottbenzle
ID: 22810235
It's not letting me access because I am uplaoding with ASPupload in the same page. I had to pass the parameters to a new page so that only one upload was happening per page. At least I think that's why it worked.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question