Solved

Access Denied error when uploading image

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Classic ASP + JS 4 93
Issues with Insert statement 12 25
Button to go back 3 23
One field not displaying content (ASP Classic) 8 22
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

15 Experts available now in Live!

Get 1:1 Help Now