1 Replies - 1745 Views - Last Post: 21 August 2012 - 01:29 PM Rate Topic: -----

#1 jediokie  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 215
  • Joined: 07-February 08

File handling from the web

Posted 21 August 2012 - 09:31 AM

We have a series of applications that are using the same class to upload image files from remote users. The powers that be now want to resize those images at the server because newer cameras natively take larger image files. So I'm uploading a file to the server, taking that image and resizing it into a cache file, taking the cache file and renaming it, taking the newly renamed file and replacing the original.

I've gotten most of it worked out; however, when I attempt to move the resized image I get the following error:

Quote

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path



I've included the code I'm working with below.
            If filea.Exists Then
                Me.mPicAExists = True
                Me.mPicAPath = FileBrowseUrl & Me.ListID.ToString & "a.jpg"
                Me.mPicA.ImageUrl = FileBrowseUrl & Me.ListID.ToString & "a.jpg"

                'Create the resize and recopy to the original location.
                Dim y As New UnitedBinary.Imaging.AutoImageSize
                y.CacheDir = ConfigurationManager.AppSettings("ImageCacheDir")
                y.JPGQuality = 85
                y.RegName = "#### ####"
                y.RegCode = "eh3SShaLam9#pfbAcSXx"
                y.AspectRatioGuide = UnitedBinary.Imaging.AIS.AspectRatioGuides.Album
                Me.mSearchPicAPath = y.ChangeImageSize(FilePath & Me.ListID.ToString & "a.jpg", 800, 600)
                Dim OldPath As String = Me.mSearchPicAPath
                Dim NewPath As String = FilePath & Me.ListID.ToString & "a.jpg"
                File.Copy(Me.mSearchPicAPath, NewPath)
            End If


And the stack trace:

Quote

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path '/ImageResizeCache/d9984aeb8e1ec22140412e91e61f9cfe.jpg'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +224
System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) +9560965
System.IO.File.Copy(String sourceFileName, String destFileName) +48
WebListings.clsListing.GetPics() +531
WebListings.clsListing..ctor(Int32 ListID) +97
WebListings.UserListings.GethayListings(Int32 userid) +2633
WebListings.UserListings.Page_Load(Object sender, EventArgs e) +811
System.Web.UI.Control.onload(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


Any assistance is greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: File handling from the web

#2 jediokie  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 215
  • Joined: 07-February 08

Re: File handling from the web

Posted 21 August 2012 - 01:29 PM

I had to change the code as shown below to get out of that error:
Dim NewPath As String = System.IO.Path.GetFileName(FilePath & Me.ListID.ToString & "a.jpg")


Just adding the System.IO.Path resolved it. Now I'm fighting permission issues.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1