Solved

Access Denied error when uploading image

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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