Solved

Access Denied error when uploading image

Posted on 2008-10-26
2
1,364 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now