Solved

Access Denied error when uploading image

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Join 9 61
How to solve this equation 3 52
add custom headers to my mail 2 48
VBSCRIPT string remove all characters to the right after extension 4 53
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 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

26 Experts available now in Live!

Get 1:1 Help Now